/*=========================================================================

Program:   Medical Imaging & Interaction Toolkit
Language:  C++
Date:      $Date: 2010-11-11 21:55:31 +0800 (周四, 11 十一月 2010) $
Version:   $Revision: 27513 $

Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.

This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.  See the above copyright notices for more information.

=========================================================================*/

#define SMW_INFO MITK_INFO("widget.stdmulti")

#include "QmitkStdMultiWidget.h"

#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QGridLayout>
#include <qsplitter.h>
#include <QMotifStyle>
#include <QList>
#include <QMouseEvent>

#include "mitkProperties.h"
#include "mitkGeometry2DDataMapper2D.h"
#include "mitkGlobalInteraction.h"
#include "mitkDisplayInteractor.h"
#include "mitkPointSet.h"
#include "mitkPositionEvent.h"
#include "mitkStateEvent.h"
#include "mitkLine.h"
#include "mitkInteractionConst.h"
#include "mitkDataStorage.h"

#include "mitkVtkLayerController.h"

QmitkStdMultiWidget::QmitkStdMultiWidget(QWidget* parent, Qt::WindowFlags f)
: QWidget(parent, f), 
mitkWidget1(NULL),
mitkWidget2(NULL),
mitkWidget3(NULL),
mitkWidget4(NULL),
mitkWidget5(NULL),
mitkWidget6(NULL),
mitkWidget7(NULL),
m_PlaneNode1(NULL), 
m_PlaneNode2(NULL), 
m_PlaneNode3(NULL), 
m_Node(NULL)
{
  /*******************************/
  //Create Widget manually
  /*******************************/

  //create Layouts
  QmitkStdMultiWidgetLayout = new QHBoxLayout( this ); 

  //Set Layout to widget
  this->setLayout(QmitkStdMultiWidgetLayout);

//  QmitkNavigationToolBar* toolBar = new QmitkNavigationToolBar();
//  QmitkStdMultiWidgetLayout->addWidget( toolBar );

  //create main splitter
  m_MainSplit = new QSplitter( this );
  QmitkStdMultiWidgetLayout->addWidget( m_MainSplit );

  //create m_LayoutSplit  and add to the mainSplit
  m_LayoutSplit = new QSplitter( Qt::Vertical, m_MainSplit );
  m_MainSplit->addWidget( m_LayoutSplit );

  //create m_SubSplit1 and m_SubSplit2  
  m_SubSplit1 = new QSplitter( m_LayoutSplit );
  m_SubSplit2 = new QSplitter( m_LayoutSplit );

  //creae Widget Container
  mitkWidget1Container = new QWidget(m_SubSplit1);
  mitkWidget2Container = new QWidget(m_SubSplit1);
  mitkWidget3Container = new QWidget(m_SubSplit2);
  mitkWidget4Container = new QWidget(m_SubSplit2);
  mitkWidget5Container = new QWidget(m_SubSplit2);
  mitkWidget6Container = new QWidget(m_SubSplit2);
  mitkWidget7Container = new QWidget(m_SubSplit2);

  mitkWidget1Container->setContentsMargins(0,0,0,0);
  mitkWidget2Container->setContentsMargins(0,0,0,0);
  mitkWidget3Container->setContentsMargins(0,0,0,0);
  mitkWidget4Container->setContentsMargins(0,0,0,0);
  mitkWidget5Container->setContentsMargins(0,0,0,0);
  mitkWidget6Container->setContentsMargins(0,0,0,0);
  mitkWidget7Container->setContentsMargins(0,0,0,0);

  //create Widget Layout
  QHBoxLayout *mitkWidgetLayout1 = new QHBoxLayout(mitkWidget1Container);
  QHBoxLayout *mitkWidgetLayout2 = new QHBoxLayout(mitkWidget2Container);
  QHBoxLayout *mitkWidgetLayout3 = new QHBoxLayout(mitkWidget3Container);
  QHBoxLayout *mitkWidgetLayout4 = new QHBoxLayout(mitkWidget4Container);
  QHBoxLayout *mitkWidgetLayout5 = new QHBoxLayout(mitkWidget5Container);
  QHBoxLayout *mitkWidgetLayout6 = new QHBoxLayout(mitkWidget6Container);
  QHBoxLayout *mitkWidgetLayout7 = new QHBoxLayout(mitkWidget7Container);

  mitkWidgetLayout1->setMargin(0);
  mitkWidgetLayout2->setMargin(0);
  mitkWidgetLayout3->setMargin(0);
  mitkWidgetLayout4->setMargin(0);
  mitkWidgetLayout5->setMargin(0);
  mitkWidgetLayout6->setMargin(0);
  mitkWidgetLayout7->setMargin(0);

  //set Layout to Widget Container  
  mitkWidget1Container->setLayout(mitkWidgetLayout1); 
  mitkWidget2Container->setLayout(mitkWidgetLayout2); 
  mitkWidget3Container->setLayout(mitkWidgetLayout3); 
  mitkWidget4Container->setLayout(mitkWidgetLayout4); 
  mitkWidget5Container->setLayout(mitkWidgetLayout5);
  mitkWidget6Container->setLayout(mitkWidgetLayout6);
  mitkWidget7Container->setLayout(mitkWidgetLayout7);

  //set SizePolicy
  mitkWidget1Container->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
  mitkWidget2Container->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
  mitkWidget3Container->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
  mitkWidget4Container->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
  mitkWidget5Container->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
  mitkWidget6Container->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
  mitkWidget7Container->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);


  //insert Widget Container into the splitters
  m_SubSplit1->addWidget( mitkWidget1Container );
  m_SubSplit1->addWidget( mitkWidget2Container );

  m_SubSplit2->addWidget( mitkWidget3Container );
  m_SubSplit2->addWidget( mitkWidget4Container );

//  mitk::RenderingManager::GetInstance()->SetGlobalInteraction( mitk::GlobalInteraction::GetInstance() );

  //Create RenderWindows 1
  mitkWidget1 = new QmitkRenderWindow(mitkWidget1Container, "stdmulti.widget1");
  mitkWidget1->setMaximumSize(2000,2000);
  mitkWidget1->SetLayoutIndex( TRANSVERSAL );
  mitkWidgetLayout1->addWidget(mitkWidget1); 

  //Create RenderWindows 2
  mitkWidget2 = new QmitkRenderWindow(mitkWidget2Container, "stdmulti.widget2");
  mitkWidget2->setMaximumSize(2000,2000);
  mitkWidget2->setEnabled( TRUE );
  mitkWidget2->SetLayoutIndex( SAGITTAL );
  mitkWidgetLayout2->addWidget(mitkWidget2); 

  //Create RenderWindows 3
  mitkWidget3 = new QmitkRenderWindow(mitkWidget3Container, "stdmulti.widget3");
  mitkWidget3->setMaximumSize(2000,2000);
  mitkWidget3->SetLayoutIndex( CORONAL );
  mitkWidgetLayout3->addWidget(mitkWidget3); 

  //Create RenderWindows 4
  mitkWidget4 = new QmitkRenderWindow(mitkWidget4Container, "stdmulti.widget4");
  mitkWidget4->setMaximumSize(2000,2000);
  mitkWidget4->SetLayoutIndex( THREE_D );
  mitkWidgetLayout4->addWidget(mitkWidget4); 

  //Create RenderWindows 5
  mitkWidget5 = new QmitkRenderWindow(mitkWidget5Container, "stdmulti.widget5");
  mitkWidget5->setMaximumSize(2000,2000);
  mitkWidget5->SetLayoutIndex( ADDITIONAL1 );
  mitkWidgetLayout5->addWidget(mitkWidget5);

  //Create RenderWindows 6
  mitkWidget6 = new QmitkRenderWindow(mitkWidget6Container, "stdmulti.widget6");
  mitkWidget6->setMaximumSize(2000,2000);
  mitkWidget6->SetLayoutIndex( ADDITIONAL2 );
  mitkWidgetLayout6->addWidget(mitkWidget6);

  //Create RenderWindows 7
  mitkWidget7 = new QmitkRenderWindow(mitkWidget7Container, "stdmulti.widget7");
  mitkWidget7->setMaximumSize(2000,2000);
  mitkWidget7->SetLayoutIndex( ADDITIONAL3 );
  mitkWidgetLayout7->addWidget(mitkWidget7);

  //create SignalSlot Connection
  connect( mitkWidget1, SIGNAL( SignalLayoutDesignChanged(int) ), this, SLOT( OnLayoutDesignChanged(int) ) );
  connect( mitkWidget1, SIGNAL( ResetView() ), this, SLOT( ResetCrosshair() ) );
  connect( mitkWidget1, SIGNAL( ChangeCrosshairRotationMode(int) ), this, SLOT( SetWidgetPlaneMode(int) ) );
  connect( this, SIGNAL(WidgetNotifyNewCrossHairMode(int)), mitkWidget1, SLOT(OnWidgetPlaneModeChanged(int)) );

  connect( mitkWidget2, SIGNAL( SignalLayoutDesignChanged(int) ), this, SLOT( OnLayoutDesignChanged(int) ) );
  connect( mitkWidget2, SIGNAL( ResetView() ), this, SLOT( ResetCrosshair() ) );
  connect( mitkWidget2, SIGNAL( ChangeCrosshairRotationMode(int) ), this, SLOT( SetWidgetPlaneMode(int) ) );
  connect( this, SIGNAL(WidgetNotifyNewCrossHairMode(int)), mitkWidget2, SLOT(OnWidgetPlaneModeChanged(int)) );

  connect( mitkWidget3, SIGNAL( SignalLayoutDesignChanged(int) ), this, SLOT( OnLayoutDesignChanged(int) ) );
  connect( mitkWidget3, SIGNAL( ResetView() ), this, SLOT( ResetCrosshair() ) );
  connect( mitkWidget3, SIGNAL( ChangeCrosshairRotationMode(int) ), this, SLOT( SetWidgetPlaneMode(int) ) );
  connect( this, SIGNAL(WidgetNotifyNewCrossHairMode(int)), mitkWidget3, SLOT(OnWidgetPlaneModeChanged(int)) );

  connect( mitkWidget4, SIGNAL( SignalLayoutDesignChanged(int) ), this, SLOT( OnLayoutDesignChanged(int) ) );
  connect( mitkWidget4, SIGNAL( ResetView() ), this, SLOT( ResetCrosshair() ) );
  connect( mitkWidget4, SIGNAL( ChangeCrosshairRotationMode(int) ), this, SLOT( SetWidgetPlaneMode(int) ) );
  connect( this, SIGNAL(WidgetNotifyNewCrossHairMode(int)), mitkWidget4, SLOT(OnWidgetPlaneModeChanged(int)) );

  connect( mitkWidget5, SIGNAL( SignalLayoutDesignChanged(int) ), this, SLOT( OnLayoutDesignChanged(int) ) );
  connect( mitkWidget5, SIGNAL( ResetView() ), this, SLOT( ResetCrosshair() ) );
  connect( mitkWidget5, SIGNAL( ChangeCrosshairRotationMode(int) ), this, SLOT( SetWidgetPlaneMode(int) ) );
  connect( this, SIGNAL(WidgetNotifyNewCrossHairMode(int)), mitkWidget5, SLOT(OnWidgetPlaneModeChanged(int)) );

  connect( mitkWidget6, SIGNAL( SignalLayoutDesignChanged(int) ), this, SLOT( OnLayoutDesignChanged(int) ) );
  connect( mitkWidget6, SIGNAL( ResetView() ), this, SLOT( ResetCrosshair() ) );
  connect( mitkWidget6, SIGNAL( ChangeCrosshairRotationMode(int) ), this, SLOT( SetWidgetPlaneMode(int) ) );
  connect( this, SIGNAL(WidgetNotifyNewCrossHairMode(int)), mitkWidget6, SLOT(OnWidgetPlaneModeChanged(int)) );

  connect( mitkWidget7, SIGNAL( SignalLayoutDesignChanged(int) ), this, SLOT( OnLayoutDesignChanged(int) ) );
  connect( mitkWidget7, SIGNAL( ResetView() ), this, SLOT( ResetCrosshair() ) );
  connect( mitkWidget7, SIGNAL( ChangeCrosshairRotationMode(int) ), this, SLOT( SetWidgetPlaneMode(int) ) );
  connect( this, SIGNAL(WidgetNotifyNewCrossHairMode(int)), mitkWidget7, SLOT(OnWidgetPlaneModeChanged(int)) );

  //Create Level Window Widget
  levelWindowWidget = new QmitkLevelWindowWidget( m_MainSplit ); //this
  levelWindowWidget->setObjectName(QString::fromUtf8("levelWindowWidget"));
  QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
  sizePolicy.setHorizontalStretch(0);
  sizePolicy.setVerticalStretch(0);
  sizePolicy.setHeightForWidth(levelWindowWidget->sizePolicy().hasHeightForWidth());
  levelWindowWidget->setSizePolicy(sizePolicy);
  levelWindowWidget->setMaximumSize(QSize(50, 2000));
  
  //add LevelWindow Widget to mainSplitter
  m_MainSplit->addWidget( levelWindowWidget );

  //show mainSplitt and add to Layout
  mitkWidget5Container->hide();
  mitkWidget6Container->hide();
  mitkWidget7Container->hide();
  m_MainSplit->show();

  //resize Image.
  this->resize( QSize(364, 477).expandedTo(minimumSizeHint()) );

  //Initialize the widgets.
  this->InitializeWidget();

  //Activate Widget Menu
  this->ActivateMenuWidget( true );
}

void QmitkStdMultiWidget::InitializeWidget()
{
  m_PositionTracker = NULL;

  // transfer colors in WorldGeometry-Nodes of the associated Renderer
  QColor qcolor;
  //float color[3] = {1.0f,1.0f,1.0f};
  mitk::DataNode::Pointer planeNode;
  mitk::IntProperty::Pointer  layer;

  // ... of widget 1
  planeNode = mitk::BaseRenderer::GetInstance(mitkWidget1->GetRenderWindow())->GetCurrentWorldGeometry2DNode();
  planeNode->SetColor(1.0,0.0,0.0);
  layer = mitk::IntProperty::New(1000);
  planeNode->SetProperty("layer",layer);

  // ... of widget 2
  planeNode = mitk::BaseRenderer::GetInstance(mitkWidget2->GetRenderWindow())->GetCurrentWorldGeometry2DNode();
  planeNode->SetColor(0.0,1.0,0.0);
  layer = mitk::IntProperty::New(1000);
  planeNode->SetProperty("layer",layer);

  // ... of widget 3
  planeNode = mitk::BaseRenderer::GetInstance(mitkWidget3->GetRenderWindow())->GetCurrentWorldGeometry2DNode();
  planeNode->SetColor(0.0,0.0,1.0);
  layer = mitk::IntProperty::New(1000);
  planeNode->SetProperty("layer",layer);

  // ... of widget 4
  planeNode = mitk::BaseRenderer::GetInstance(mitkWidget4->GetRenderWindow())->GetCurrentWorldGeometry2DNode();
  planeNode->SetColor(1.0,1.0,0.0);
  layer = mitk::IntProperty::New(1000);
  planeNode->SetProperty("layer",layer);

  mitk::BaseRenderer::GetInstance(mitkWidget4->GetRenderWindow())->SetMapperID(mitk::BaseRenderer::Standard3D);
  mitk::BaseRenderer::GetInstance(mitkWidget5->GetRenderWindow())->SetMapperID(mitk::BaseRenderer::Standard3D);
  mitk::BaseRenderer::GetInstance(mitkWidget6->GetRenderWindow())->SetMapperID(mitk::BaseRenderer::Standard3D);
  mitk::BaseRenderer::GetInstance(mitkWidget7->GetRenderWindow())->SetMapperID(mitk::BaseRenderer::Standard2D);
  // Set plane mode (slicing/rotation behavior) to slicing (default)
  m_PlaneMode = PLANE_MODE_SLICING;

  // Set default view directions for SNCs
  mitkWidget1->GetSliceNavigationController()->SetDefaultViewDirection(
    mitk::SliceNavigationController::Transversal );
  mitkWidget2->GetSliceNavigationController()->SetDefaultViewDirection(
    mitk::SliceNavigationController::Sagittal );
  mitkWidget3->GetSliceNavigationController()->SetDefaultViewDirection(
    mitk::SliceNavigationController::Frontal );
  mitkWidget4->GetSliceNavigationController()->SetDefaultViewDirection(
    mitk::SliceNavigationController::Original );
  mitkWidget5->GetSliceNavigationController()->SetDefaultViewDirection(
    mitk::SliceNavigationController::Original );
  mitkWidget6->GetSliceNavigationController()->SetDefaultViewDirection(
    mitk::SliceNavigationController::Original );
  mitkWidget7->GetSliceNavigationController()->SetDefaultViewDirection(
    mitk::SliceNavigationController::Original );
  /*************************************************/
  //Write Layout Names into the viewers -- hardCoded

  //Info for later: 
  //int view = this->GetRenderWindow1()->GetSliceNavigationController()->GetDefaultViewDirection();
  //QString layoutName;
  //if( view == mitk::SliceNavigationController::Transversal )
  //  layoutName = "Transversal";
  //else if( view == mitk::SliceNavigationController::Sagittal )
  //  layoutName = "Sagittal";
  //else if( view == mitk::SliceNavigationController::Frontal )
  //  layoutName = "Coronal";
  //else if( view == mitk::SliceNavigationController::Original )
  //  layoutName = "Original";
  //if( view >= 0 && view < 4 )
  //  //write LayoutName --> Viewer 3D shoudn't write the layoutName.

  //Render Window 1 == transversal
  /*m_CornerAnnotaions[0].cornerText = vtkCornerAnnotation::New();
  m_CornerAnnotaions[0].cornerText->SetText(0, "Transversal");
  m_CornerAnnotaions[0].cornerText->SetMaximumFontSize(12);
  m_CornerAnnotaions[0].textProp = vtkTextProperty::New();
  m_CornerAnnotaions[0].textProp->SetColor( 1.0, 0.0, 0.0 );
  m_CornerAnnotaions[0].cornerText->SetTextProperty( m_CornerAnnotaions[0].textProp );
  m_CornerAnnotaions[0].ren = vtkRenderer::New();
  m_CornerAnnotaions[0].ren->AddActor(m_CornerAnnotaions[0].cornerText);
  m_CornerAnnotaions[0].ren->InteractiveOff();
  mitk::VtkLayerController::GetInstance(this->GetRenderWindow1()->GetRenderWindow())->InsertForegroundRenderer(m_CornerAnnotaions[0].ren,true);
  
  //Render Window 2 == sagittal
  m_CornerAnnotaions[1].cornerText = vtkCornerAnnotation::New();
  m_CornerAnnotaions[1].cornerText->SetText(0, "Sagittal");
  m_CornerAnnotaions[1].cornerText->SetMaximumFontSize(12);
  m_CornerAnnotaions[1].textProp = vtkTextProperty::New();
  m_CornerAnnotaions[1].textProp->SetColor( 0.0, 1.0, 0.0 );
  m_CornerAnnotaions[1].cornerText->SetTextProperty( m_CornerAnnotaions[1].textProp );
  m_CornerAnnotaions[1].ren = vtkRenderer::New();
  m_CornerAnnotaions[1].ren->AddActor(m_CornerAnnotaions[1].cornerText);
  m_CornerAnnotaions[1].ren->InteractiveOff();
  mitk::VtkLayerController::GetInstance(this->GetRenderWindow2()->GetRenderWindow())->InsertForegroundRenderer(m_CornerAnnotaions[1].ren,true);
  
  //Render Window 3 == coronal
  m_CornerAnnotaions[2].cornerText = vtkCornerAnnotation::New();
  m_CornerAnnotaions[2].cornerText->SetText(0, "Coronal");
  m_CornerAnnotaions[2].cornerText->SetMaximumFontSize(12);
  m_CornerAnnotaions[2].textProp = vtkTextProperty::New();
  m_CornerAnnotaions[2].textProp->SetColor( 0.295, 0.295, 1.0 );
  m_CornerAnnotaions[2].cornerText->SetTextProperty( m_CornerAnnotaions[2].textProp );
  m_CornerAnnotaions[2].ren = vtkRenderer::New();
  m_CornerAnnotaions[2].ren->AddActor(m_CornerAnnotaions[2].cornerText);
  m_CornerAnnotaions[2].ren->InteractiveOff();
  mitk::VtkLayerController::GetInstance(this->GetRenderWindow3()->GetRenderWindow())->InsertForegroundRenderer(m_CornerAnnotaions[2].ren,true);
  */ 
  /*************************************************/


  /*************************************************/
  //Render Window 1 == transversal
  m_CornerAnnotaions[0].cornerTextProp=WxvtkTextPropertyUnicode::New();
  m_CornerAnnotaions[0].cornerTextProp->SetFontFileName("simhei.ttf");
  m_CornerAnnotaions[0].cornerTextProp->SetFontSize(16);
  m_CornerAnnotaions[0].cornerTextProp->SetColor(1.0,0.5,0.5);
  m_CornerAnnotaions[0].cornerTextMapper=WxvtkFTGLChineseCharacterMapper::New();
  m_CornerAnnotaions[0].cornerTextMapper->SetTextProperty(m_CornerAnnotaions[0].cornerTextProp);
  m_CornerAnnotaions[0].cornerTextMapper->SetInput("横断位");
  m_CornerAnnotaions[0].cornerTextActor=vtkActor2D::New();
  m_CornerAnnotaions[0].cornerTextActor->SetMapper(m_CornerAnnotaions[0].cornerTextMapper);
  m_CornerAnnotaions[0].cornerTextActor->SetPosition(8,8);
  m_CornerAnnotaions[0].ren = vtkRenderer::New();
  m_CornerAnnotaions[0].ren->AddActor(m_CornerAnnotaions[0].cornerTextActor);
  m_CornerAnnotaions[0].ren->InteractiveOff();
  mitk::VtkLayerController::GetInstance(this->GetRenderWindow1()->GetRenderWindow())->InsertForegroundRenderer(m_CornerAnnotaions[0].ren,true);

  //Render Window 2 == sagittal
  m_CornerAnnotaions[1].cornerTextProp=WxvtkTextPropertyUnicode::New();
  m_CornerAnnotaions[1].cornerTextProp->SetFontFileName("simhei.ttf");
  m_CornerAnnotaions[1].cornerTextProp->SetFontSize(16);
  m_CornerAnnotaions[1].cornerTextProp->SetColor(1.0,0.5,0.5);
  m_CornerAnnotaions[1].cornerTextMapper=WxvtkFTGLChineseCharacterMapper::New();
  m_CornerAnnotaions[1].cornerTextMapper->SetTextProperty(m_CornerAnnotaions[1].cornerTextProp);
  m_CornerAnnotaions[1].cornerTextMapper->SetInput("矢状位");
  m_CornerAnnotaions[1].cornerTextActor=vtkActor2D::New();
  m_CornerAnnotaions[1].cornerTextActor->SetMapper(m_CornerAnnotaions[1].cornerTextMapper);
  m_CornerAnnotaions[1].cornerTextActor->SetPosition(8,8);
  m_CornerAnnotaions[1].ren = vtkRenderer::New();
  m_CornerAnnotaions[1].ren->AddActor(m_CornerAnnotaions[1].cornerTextActor);
  m_CornerAnnotaions[1].ren->InteractiveOff();
  mitk::VtkLayerController::GetInstance(this->GetRenderWindow2()->GetRenderWindow())->InsertForegroundRenderer(m_CornerAnnotaions[1].ren,true);

  //Render Window 3 == coronal
  m_CornerAnnotaions[2].cornerTextProp=WxvtkTextPropertyUnicode::New();
  m_CornerAnnotaions[2].cornerTextProp->SetFontFileName("simhei.ttf");
  m_CornerAnnotaions[2].cornerTextProp->SetFontSize(16);
  m_CornerAnnotaions[2].cornerTextProp->SetColor(1.0,0.5,0.5);
  m_CornerAnnotaions[2].cornerTextMapper=WxvtkFTGLChineseCharacterMapper::New();
  m_CornerAnnotaions[2].cornerTextMapper->SetTextProperty(m_CornerAnnotaions[2].cornerTextProp);
  m_CornerAnnotaions[2].cornerTextMapper->SetInput("冠状位");
  m_CornerAnnotaions[2].cornerTextActor=vtkActor2D::New();
  m_CornerAnnotaions[2].cornerTextActor->SetMapper(m_CornerAnnotaions[2].cornerTextMapper);
  m_CornerAnnotaions[2].cornerTextActor->SetPosition(8,8);
  m_CornerAnnotaions[2].ren = vtkRenderer::New();
  m_CornerAnnotaions[2].ren->AddActor(m_CornerAnnotaions[2].cornerTextActor);
  m_CornerAnnotaions[2].ren->InteractiveOff();
  mitk::VtkLayerController::GetInstance(this->GetRenderWindow3()->GetRenderWindow())->InsertForegroundRenderer(m_CornerAnnotaions[2].ren,true);

  /*************************************************/                                                    

  // create a slice rotator
  // m_SlicesRotator = mitk::SlicesRotator::New();
  // @TODO next line causes sure memory leak
  // rotator will be created nonetheless (will be switched on and off)
  m_SlicesRotator = mitk::SlicesRotator::New("slices-rotator");
  m_SlicesRotator->AddSliceController(
    mitkWidget1->GetSliceNavigationController() );
  m_SlicesRotator->AddSliceController(
    mitkWidget2->GetSliceNavigationController() );
  m_SlicesRotator->AddSliceController(
    mitkWidget3->GetSliceNavigationController() );

  // create a slice swiveller (using the same state-machine as SlicesRotator)
  m_SlicesSwiveller = mitk::SlicesSwiveller::New("slices-rotator");
  m_SlicesSwiveller->AddSliceController(
    mitkWidget1->GetSliceNavigationController() );
  m_SlicesSwiveller->AddSliceController(
    mitkWidget2->GetSliceNavigationController() );
  m_SlicesSwiveller->AddSliceController(
    mitkWidget3->GetSliceNavigationController() );

  //initialize m_TimeNavigationController: send time via sliceNavigationControllers
  m_TimeNavigationController = mitk::SliceNavigationController::New("dummy");
  m_TimeNavigationController->ConnectGeometryTimeEvent(
    mitkWidget1->GetSliceNavigationController() , false);
  m_TimeNavigationController->ConnectGeometryTimeEvent(
    mitkWidget2->GetSliceNavigationController() , false);
  m_TimeNavigationController->ConnectGeometryTimeEvent(
    mitkWidget3->GetSliceNavigationController() , false);
  m_TimeNavigationController->ConnectGeometryTimeEvent(
    mitkWidget4->GetSliceNavigationController() , false);
  mitkWidget1->GetSliceNavigationController()
    ->ConnectGeometrySendEvent(mitk::BaseRenderer::GetInstance(mitkWidget4->GetRenderWindow()));

  // Set TimeNavigationController to RenderingManager
  // (which uses it internally for views initialization!)
  mitk::RenderingManager::GetInstance()->SetTimeNavigationController(
    m_TimeNavigationController );

  //reverse connection between sliceNavigationControllers and m_TimeNavigationController
  mitkWidget1->GetSliceNavigationController()
    ->ConnectGeometryTimeEvent(m_TimeNavigationController.GetPointer(), false);
  mitkWidget2->GetSliceNavigationController()
    ->ConnectGeometryTimeEvent(m_TimeNavigationController.GetPointer(), false);
  mitkWidget3->GetSliceNavigationController()
    ->ConnectGeometryTimeEvent(m_TimeNavigationController.GetPointer(), false);
  mitkWidget4->GetSliceNavigationController()
    ->ConnectGeometryTimeEvent(m_TimeNavigationController.GetPointer(), false);

  // instantiate display interactor
  m_MoveAndZoomInteractor = mitk::DisplayVectorInteractor::New(
    "moveNzoom", new mitk::DisplayInteractor() );

  m_LastLeftClickPositionSupplier =
    mitk::CoordinateSupplier::New("navigation", NULL);
  mitk::GlobalInteraction::GetInstance()->AddListener(
    m_LastLeftClickPositionSupplier
    );
  // setup gradient background
  m_GradientBackground1 = mitk::GradientBackground::New();
  m_GradientBackground1->SetRenderWindow(
    mitkWidget1->GetRenderWindow() );
  m_GradientBackground1->Disable();

  m_GradientBackground2 = mitk::GradientBackground::New();
  m_GradientBackground2->SetRenderWindow(
    mitkWidget2->GetRenderWindow() );
  m_GradientBackground2->Disable();

  m_GradientBackground3 = mitk::GradientBackground::New();
  m_GradientBackground3->SetRenderWindow(
    mitkWidget3->GetRenderWindow() );
  m_GradientBackground3->Disable();

  m_GradientBackground4 = mitk::GradientBackground::New();
  m_GradientBackground4->SetRenderWindow(
    mitkWidget4->GetRenderWindow() );
  m_GradientBackground4->SetGradientColors(0.1,0.2,0.3,0.6,0.7,0.8);
  m_GradientBackground4->Enable();

  m_GradientBackground5 = mitk::GradientBackground::New();
  m_GradientBackground5->SetRenderWindow(
    mitkWidget5->GetRenderWindow() );
  m_GradientBackground5->Disable();

  m_GradientBackground6 = mitk::GradientBackground::New();
  m_GradientBackground6->SetRenderWindow(
    mitkWidget6->GetRenderWindow() );
  m_GradientBackground6->Disable();

  m_GradientBackground7 = mitk::GradientBackground::New();
  m_GradientBackground7->SetRenderWindow(
    mitkWidget7->GetRenderWindow() );
  m_GradientBackground7->Disable();

  // setup the department logo rendering
  m_LogoRendering1 = mitk::ManufacturerLogo::New();
  m_LogoRendering1->SetRenderWindow(
    mitkWidget1->GetRenderWindow() );
  m_LogoRendering1->Disable();

  m_LogoRendering2 = mitk::ManufacturerLogo::New();
  m_LogoRendering2->SetRenderWindow(
    mitkWidget2->GetRenderWindow() );
  m_LogoRendering2->Disable();

  m_LogoRendering3 = mitk::ManufacturerLogo::New();
  m_LogoRendering3->SetRenderWindow(
    mitkWidget3->GetRenderWindow() );
  m_LogoRendering3->Disable();

  m_LogoRendering4 = mitk::ManufacturerLogo::New();
  m_LogoRendering4->SetRenderWindow(
    mitkWidget4->GetRenderWindow() );
  m_LogoRendering4->Disable();

  m_LogoRendering5 = mitk::ManufacturerLogo::New();
  m_LogoRendering5->SetRenderWindow(
    mitkWidget5->GetRenderWindow() );
  m_LogoRendering5->Disable();

  m_LogoRendering6 = mitk::ManufacturerLogo::New();
  m_LogoRendering6->SetRenderWindow(
    mitkWidget6->GetRenderWindow() );
  m_LogoRendering6->Disable();

  m_LogoRendering7 = mitk::ManufacturerLogo::New();
  m_LogoRendering7->SetRenderWindow(
    mitkWidget7->GetRenderWindow() );
  m_LogoRendering7->Disable();

  ////////////////////////////////////////////////////////
  m_RectangleRendering1 = mitk::RenderWindowFrame::New();
  m_RectangleRendering1->SetRenderWindow(
    mitkWidget1->GetRenderWindow() );
  m_RectangleRendering1->Enable(1.0,0.0,0.0);

  m_RectangleRendering2 = mitk::RenderWindowFrame::New();
  m_RectangleRendering2->SetRenderWindow(
    mitkWidget2->GetRenderWindow() );
  m_RectangleRendering2->Enable(0.0,1.0,0.0);

  m_RectangleRendering3 = mitk::RenderWindowFrame::New();
  m_RectangleRendering3->SetRenderWindow(
    mitkWidget3->GetRenderWindow() );
  m_RectangleRendering3->Enable(0.0,0.0,1.0);

  m_RectangleRendering4 = mitk::RenderWindowFrame::New();
  m_RectangleRendering4->SetRenderWindow(
    mitkWidget4->GetRenderWindow() );
  m_RectangleRendering4->Enable(1.0,1.0,0.0);

  m_RectangleRendering5 = mitk::RenderWindowFrame::New();
  m_RectangleRendering5->SetRenderWindow(
    mitkWidget5->GetRenderWindow() );
  m_RectangleRendering5->Enable(1.0,0.0,1.0);

  m_RectangleRendering6 = mitk::RenderWindowFrame::New();
  m_RectangleRendering6->SetRenderWindow(
    mitkWidget6->GetRenderWindow() );
  m_RectangleRendering6->Enable(0.0,1.0,1.0);

  m_RectangleRendering7 = mitk::RenderWindowFrame::New();
  m_RectangleRendering7->SetRenderWindow(
    mitkWidget7->GetRenderWindow() );
  m_RectangleRendering7->Enable(0.0,0.0,0.0);

  //////////////////////////////////////////////////////
  m_OrientationMark=new WxOrientationMark(this->GetRenderWindow4()->GetRenderWindow()->GetInteractor(),"marker.stl");
  m_OrientationMark->SetAxesVisible(false);
  m_OrientationMark->SetCubeVisible(true);
  m_OrientationMark->SetModelVisible(true);
  //////////////////////////////////////////////////////

}
  
QmitkStdMultiWidget::~QmitkStdMultiWidget()
{
  DisablePositionTracking();
  DisableNavigationControllerEventListening();

  mitk::VtkLayerController::GetInstance(this->GetRenderWindow1()->GetRenderWindow())->RemoveRenderer( m_CornerAnnotaions[0].ren );
  mitk::VtkLayerController::GetInstance(this->GetRenderWindow2()->GetRenderWindow())->RemoveRenderer( m_CornerAnnotaions[1].ren );
  mitk::VtkLayerController::GetInstance(this->GetRenderWindow3()->GetRenderWindow())->RemoveRenderer( m_CornerAnnotaions[2].ren );

  //Delete CornerAnnotation
  /*m_CornerAnnotaions[0].cornerText->Delete();
  m_CornerAnnotaions[0].textProp->Delete();
  m_CornerAnnotaions[0].ren->Delete();

  m_CornerAnnotaions[1].cornerText->Delete();
  m_CornerAnnotaions[1].textProp->Delete();
  m_CornerAnnotaions[1].ren->Delete();

  m_CornerAnnotaions[2].cornerText->Delete();
  m_CornerAnnotaions[2].textProp->Delete();
  m_CornerAnnotaions[2].ren->Delete();*/

  //Delete CornerAnnotation
  m_CornerAnnotaions[0].cornerTextMapper->Delete();
  m_CornerAnnotaions[0].cornerTextActor->Delete();
  m_CornerAnnotaions[0].cornerTextProp->Delete();
  m_CornerAnnotaions[0].ren->Delete();

  m_CornerAnnotaions[1].cornerTextMapper->Delete();
  m_CornerAnnotaions[1].cornerTextActor->Delete();
  m_CornerAnnotaions[1].cornerTextProp->Delete();
  m_CornerAnnotaions[1].ren->Delete();

  m_CornerAnnotaions[2].cornerTextMapper->Delete();
  m_CornerAnnotaions[2].cornerTextActor->Delete();
  m_CornerAnnotaions[2].cornerTextProp->Delete();
  m_CornerAnnotaions[2].ren->Delete();

  delete m_OrientationMark;
}

void QmitkStdMultiWidget::RemovePlanesFromDataStorage()
{
  if (m_PlaneNode1.IsNotNull() && m_PlaneNode2.IsNotNull() && m_PlaneNode3.IsNotNull() && m_Node.IsNotNull())
  {
    if(m_DataStorage.IsNotNull())
    {
      m_DataStorage->Remove(m_PlaneNode1);
      m_DataStorage->Remove(m_PlaneNode2);
      m_DataStorage->Remove(m_PlaneNode3);
      m_DataStorage->Remove(m_PlaneNode7);
      m_DataStorage->Remove(m_Node);
    }
  }
}

void QmitkStdMultiWidget::AddPlanesToDataStorage()
{
  if (m_PlaneNode1.IsNotNull() && m_PlaneNode2.IsNotNull() && m_PlaneNode3.IsNotNull() && m_Node.IsNotNull())
  {
    if (m_DataStorage.IsNotNull())
    {
      m_DataStorage->Add(m_Node);
      m_DataStorage->Add(m_PlaneNode1, m_Node);
      m_DataStorage->Add(m_PlaneNode2, m_Node);
      m_DataStorage->Add(m_PlaneNode3, m_Node);
      m_DataStorage->Add(m_PlaneNode7);
      static_cast<mitk::Geometry2DDataMapper2D*>(m_PlaneNode1->GetMapper(mitk::BaseRenderer::Standard2D))->SetDatastorageAndGeometryBaseNode(m_DataStorage, m_Node);
      static_cast<mitk::Geometry2DDataMapper2D*>(m_PlaneNode2->GetMapper(mitk::BaseRenderer::Standard2D))->SetDatastorageAndGeometryBaseNode(m_DataStorage, m_Node);
      static_cast<mitk::Geometry2DDataMapper2D*>(m_PlaneNode3->GetMapper(mitk::BaseRenderer::Standard2D))->SetDatastorageAndGeometryBaseNode(m_DataStorage, m_Node);
     // static_cast<mitk::Geometry2DDataMapper2D*>(m_PlaneNode7->GetMapper(mitk::BaseRenderer::Standard2D))->SetDatastorageAndGeometryBaseNode(m_DataStorage, m_PlaneNode7);
    }
  }
}

void QmitkStdMultiWidget::changeLayoutTo2DImagesUp()
{
  SMW_INFO << "changing layout to 2D images up... " << std::endl;

  //Hide all Menu Widgets
  this->HideAllWidgetToolbars();

  delete QmitkStdMultiWidgetLayout ;

  //create Main Layout
  QmitkStdMultiWidgetLayout =  new QHBoxLayout( this );

  //Set Layout to widget
  this->setLayout(QmitkStdMultiWidgetLayout);

  //create main splitter
  m_MainSplit = new QSplitter( this );
  QmitkStdMultiWidgetLayout->addWidget( m_MainSplit );

  //create m_LayoutSplit  and add to the mainSplit
  m_LayoutSplit = new QSplitter( Qt::Vertical, m_MainSplit );
  m_MainSplit->addWidget( m_LayoutSplit );

  //add LevelWindow Widget to mainSplitter
  m_MainSplit->addWidget( levelWindowWidget );

  //create m_SubSplit1 and m_SubSplit2  
  m_SubSplit1 = new QSplitter( m_LayoutSplit );
  m_SubSplit2 = new QSplitter( m_LayoutSplit );

  //insert Widget Container into splitter top
  m_SubSplit1->addWidget( mitkWidget1Container );
  m_SubSplit1->addWidget( mitkWidget2Container );
  m_SubSplit1->addWidget( mitkWidget3Container );

  //set SplitterSize for splitter top
  QList<int> splitterSize;
  splitterSize.push_back(1000);
  splitterSize.push_back(1000);
  splitterSize.push_back(1000);
  m_SubSplit1->setSizes( splitterSize );

  //insert Widget Container into splitter bottom
  m_SubSplit2->addWidget( mitkWidget4Container );

  //set SplitterSize for splitter m_LayoutSplit
  splitterSize.clear();
  splitterSize.push_back(400);
  splitterSize.push_back(1000);
  m_LayoutSplit->setSizes( splitterSize );

  //show mainSplitt
  m_MainSplit->show();

  //show Widget if hidden
  if ( mitkWidget1Container->isHidden() ) mitkWidget1Container->show();
  if ( mitkWidget2Container->isHidden() ) mitkWidget2Container->show();
  if ( mitkWidget3Container->isHidden() ) mitkWidget3Container->show();
  if ( mitkWidget4Container->isHidden() ) mitkWidget4Container->show();
  mitkWidget5Container->hide();
  mitkWidget6Container->hide();
  mitkWidget7Container->hide();

  //Change Layout Name
  m_Layout = LAYOUT_2D_IMAGES_UP;

  //update Layout Design List
  mitkWidget1->LayoutDesignListChanged( LAYOUT_2D_IMAGES_UP );
  mitkWidget2->LayoutDesignListChanged( LAYOUT_2D_IMAGES_UP );
  mitkWidget3->LayoutDesignListChanged( LAYOUT_2D_IMAGES_UP );
  mitkWidget4->LayoutDesignListChanged( LAYOUT_2D_IMAGES_UP );
  mitkWidget5->LayoutDesignListChanged( LAYOUT_2D_IMAGES_UP );
  mitkWidget6->LayoutDesignListChanged( LAYOUT_2D_IMAGES_UP );
  mitkWidget7->LayoutDesignListChanged( LAYOUT_2D_IMAGES_UP );

  //update Alle Widgets
  this->UpdateAllWidgets();
}

void QmitkStdMultiWidget::changeLayoutTo2DImagesLeft()
{
  SMW_INFO << "changing layout to 2D images left... " << std::endl;

  //Hide all Menu Widgets
  this->HideAllWidgetToolbars();

  delete QmitkStdMultiWidgetLayout ;

  //create Main Layout
  QmitkStdMultiWidgetLayout =  new QHBoxLayout( this );

  //create main splitter
  m_MainSplit = new QSplitter( this );
  QmitkStdMultiWidgetLayout->addWidget( m_MainSplit );

  //create m_LayoutSplit  and add to the mainSplit
  m_LayoutSplit = new QSplitter( m_MainSplit );
  m_MainSplit->addWidget( m_LayoutSplit );

  //add LevelWindow Widget to mainSplitter
  m_MainSplit->addWidget( levelWindowWidget );

  //create m_SubSplit1 and m_SubSplit2  
  m_SubSplit1 = new QSplitter( Qt::Vertical, m_LayoutSplit );
  m_SubSplit2 = new QSplitter( m_LayoutSplit );

  //insert Widget into the splitters
  m_SubSplit1->addWidget( mitkWidget1Container );
  m_SubSplit1->addWidget( mitkWidget2Container );
  m_SubSplit1->addWidget( mitkWidget3Container );

  //set splitterSize of SubSplit1
  QList<int> splitterSize;
  splitterSize.push_back(1000);
  splitterSize.push_back(1000);
  splitterSize.push_back(1000);
  m_SubSplit1->setSizes( splitterSize );

  m_SubSplit2->addWidget( mitkWidget4Container );

  //set splitterSize of Layout Split
  splitterSize.clear();
  splitterSize.push_back(400);
  splitterSize.push_back(1000);
  m_LayoutSplit->setSizes( splitterSize );

  //show mainSplitt and add to Layout
  m_MainSplit->show();

  //show Widget if hidden
  if ( mitkWidget1Container->isHidden() ) mitkWidget1Container->show();
  if ( mitkWidget2Container->isHidden() ) mitkWidget2Container->show();
  if ( mitkWidget3Container->isHidden() ) mitkWidget3Container->show();
  if ( mitkWidget4Container->isHidden() ) mitkWidget4Container->show();
  mitkWidget5Container->hide();
  mitkWidget6Container->hide();
  mitkWidget7Container->hide();

  //update Layout Name
  m_Layout = LAYOUT_2D_IMAGES_LEFT;

  //update Layout Design List
  mitkWidget1->LayoutDesignListChanged( LAYOUT_2D_IMAGES_LEFT );
  mitkWidget2->LayoutDesignListChanged( LAYOUT_2D_IMAGES_LEFT );
  mitkWidget3->LayoutDesignListChanged( LAYOUT_2D_IMAGES_LEFT );
  mitkWidget4->LayoutDesignListChanged( LAYOUT_2D_IMAGES_LEFT );
  mitkWidget5->LayoutDesignListChanged( LAYOUT_2D_IMAGES_LEFT );
  mitkWidget6->LayoutDesignListChanged( LAYOUT_2D_IMAGES_LEFT );
  mitkWidget7->LayoutDesignListChanged( LAYOUT_2D_IMAGES_LEFT );

  //update Alle Widgets
  this->UpdateAllWidgets();
}

void QmitkStdMultiWidget::changeLayoutToDefault()
{
  SMW_INFO << "changing layout to default... " << std::endl;

  //Hide all Menu Widgets
  this->HideAllWidgetToolbars();

  delete QmitkStdMultiWidgetLayout ;

  //create Main Layout
  QmitkStdMultiWidgetLayout =  new QHBoxLayout( this );

  //create main splitter
  m_MainSplit = new QSplitter( this );
  QmitkStdMultiWidgetLayout->addWidget( m_MainSplit );

  //create m_LayoutSplit  and add to the mainSplit
  m_LayoutSplit = new QSplitter( Qt::Vertical, m_MainSplit );
  m_MainSplit->addWidget( m_LayoutSplit );

  //add LevelWindow Widget to mainSplitter
  m_MainSplit->addWidget( levelWindowWidget );

  //create m_SubSplit1 and m_SubSplit2  
  m_SubSplit1 = new QSplitter( m_LayoutSplit );
  m_SubSplit2 = new QSplitter( m_LayoutSplit );

  //insert Widget container into the splitters
  m_SubSplit1->addWidget( mitkWidget1Container );
  m_SubSplit1->addWidget( mitkWidget2Container );

  m_SubSplit2->addWidget( mitkWidget3Container );
  m_SubSplit2->addWidget( mitkWidget4Container );

  //set splitter Size
  QList<int> splitterSize;
  splitterSize.push_back(1000);
  splitterSize.push_back(1000);
  m_SubSplit1->setSizes( splitterSize );
  m_SubSplit2->setSizes( splitterSize );
  m_LayoutSplit->setSizes( splitterSize );

  //show mainSplitt and add to Layout
  m_MainSplit->show();

  //show Widget if hidden
  if ( mitkWidget1Container->isHidden() ) mitkWidget1Container->show();
  if ( mitkWidget2Container->isHidden() ) mitkWidget2Container->show();
  if ( mitkWidget3Container->isHidden() ) mitkWidget3Container->show();
  if ( mitkWidget4Container->isHidden() ) mitkWidget4Container->show();
  mitkWidget5Container->hide();
  mitkWidget6Container->hide();
  mitkWidget7Container->hide();

  m_Layout = LAYOUT_DEFAULT;

  //update Layout Design List
  mitkWidget1->LayoutDesignListChanged( LAYOUT_DEFAULT );
  mitkWidget2->LayoutDesignListChanged( LAYOUT_DEFAULT );
  mitkWidget3->LayoutDesignListChanged( LAYOUT_DEFAULT );
  mitkWidget4->LayoutDesignListChanged( LAYOUT_DEFAULT );
  mitkWidget5->LayoutDesignListChanged( LAYOUT_DEFAULT );
  mitkWidget6->LayoutDesignListChanged( LAYOUT_DEFAULT );
  mitkWidget7->LayoutDesignListChanged( LAYOUT_DEFAULT );

  //update Alle Widgets
  this->UpdateAllWidgets();
}

void QmitkStdMultiWidget::changeLayoutToBig3D()
{
  SMW_INFO << "changing layout to big 3D ..." << std::endl;

  //Hide all Menu Widgets
  this->HideAllWidgetToolbars();

  delete QmitkStdMultiWidgetLayout ;

  //create Main Layout
  QmitkStdMultiWidgetLayout =  new QHBoxLayout( this );

  //create main splitter
  m_MainSplit = new QSplitter( this );
  QmitkStdMultiWidgetLayout->addWidget( m_MainSplit );

  //add widget Splitter to main Splitter
  m_MainSplit->addWidget( mitkWidget4Container );

  //add LevelWindow Widget to mainSplitter
  m_MainSplit->addWidget( levelWindowWidget );

  //show mainSplitt and add to Layout
  m_MainSplit->show();

  //show/hide Widgets
  mitkWidget1Container->hide();
  mitkWidget2Container->hide();
  mitkWidget3Container->hide();
  mitkWidget5Container->hide();
  mitkWidget6Container->hide();
  mitkWidget7Container->hide();

  if ( mitkWidget4Container->isHidden() ) mitkWidget4Container->show();

  m_Layout = LAYOUT_BIG_3D;

  //update Layout Design List
  mitkWidget1->LayoutDesignListChanged( LAYOUT_BIG_3D );
  mitkWidget2->LayoutDesignListChanged( LAYOUT_BIG_3D );
  mitkWidget3->LayoutDesignListChanged( LAYOUT_BIG_3D );
  mitkWidget4->LayoutDesignListChanged( LAYOUT_BIG_3D );
  mitkWidget5->LayoutDesignListChanged( LAYOUT_BIG_3D );
  mitkWidget6->LayoutDesignListChanged( LAYOUT_BIG_3D );
  mitkWidget7->LayoutDesignListChanged( LAYOUT_BIG_3D );

  //update Alle Widgets
  this->UpdateAllWidgets();
}

void QmitkStdMultiWidget::changeLayoutToWidget1()
{
  SMW_INFO << "changing layout to big Widget1 ..." << std::endl;

  //Hide all Menu Widgets
  this->HideAllWidgetToolbars();

  delete QmitkStdMultiWidgetLayout ;

  //create Main Layout
  QmitkStdMultiWidgetLayout =  new QHBoxLayout( this );

  //create main splitter
  m_MainSplit = new QSplitter( this );
  QmitkStdMultiWidgetLayout->addWidget( m_MainSplit );

  //add widget Splitter to main Splitter
  m_MainSplit->addWidget( mitkWidget1Container );

  //add LevelWindow Widget to mainSplitter
  m_MainSplit->addWidget( levelWindowWidget );

  //show mainSplitt and add to Layout
  m_MainSplit->show();

  //show/hide Widgets
  if ( mitkWidget1Container->isHidden() ) mitkWidget1Container->show();
  mitkWidget2Container->hide();
  mitkWidget3Container->hide();
  mitkWidget4Container->hide();
  mitkWidget5Container->hide();
  mitkWidget6Container->hide();
  mitkWidget7Container->hide();

  m_Layout = LAYOUT_WIDGET1;

  //update Layout Design List
  mitkWidget1->LayoutDesignListChanged( LAYOUT_WIDGET1 );
  mitkWidget2->LayoutDesignListChanged( LAYOUT_WIDGET1 );
  mitkWidget3->LayoutDesignListChanged( LAYOUT_WIDGET1 );
  mitkWidget4->LayoutDesignListChanged( LAYOUT_WIDGET1 );
  mitkWidget5->LayoutDesignListChanged( LAYOUT_WIDGET1 );
  mitkWidget6->LayoutDesignListChanged( LAYOUT_WIDGET1 );
  mitkWidget7->LayoutDesignListChanged( LAYOUT_WIDGET1 );

  //update Alle Widgets
  this->UpdateAllWidgets();
}

void QmitkStdMultiWidget::changeLayoutToWidget2()
{
  SMW_INFO << "changing layout to big Widget2 ..." << std::endl;

  //Hide all Menu Widgets
  this->HideAllWidgetToolbars();

  delete QmitkStdMultiWidgetLayout ;

  //create Main Layout
  QmitkStdMultiWidgetLayout =  new QHBoxLayout( this );

  //create main splitter
  m_MainSplit = new QSplitter( this );
  QmitkStdMultiWidgetLayout->addWidget( m_MainSplit );

  //add widget Splitter to main Splitter
  m_MainSplit->addWidget( mitkWidget2Container );

  //add LevelWindow Widget to mainSplitter
  m_MainSplit->addWidget( levelWindowWidget );

  //show mainSplitt and add to Layout
  m_MainSplit->show();

  //show/hide Widgets
  mitkWidget1Container->hide();
  if ( mitkWidget2Container->isHidden() ) mitkWidget2Container->show();
  mitkWidget3Container->hide();
  mitkWidget4Container->hide();
  mitkWidget5Container->hide();
  mitkWidget6Container->hide();
  mitkWidget7Container->hide();

  m_Layout = LAYOUT_WIDGET2;

  //update Layout Design List
  mitkWidget1->LayoutDesignListChanged( LAYOUT_WIDGET2 );
  mitkWidget2->LayoutDesignListChanged( LAYOUT_WIDGET2 );
  mitkWidget3->LayoutDesignListChanged( LAYOUT_WIDGET2 );
  mitkWidget4->LayoutDesignListChanged( LAYOUT_WIDGET2 );
  mitkWidget5->LayoutDesignListChanged( LAYOUT_WIDGET2 );
  mitkWidget6->LayoutDesignListChanged( LAYOUT_WIDGET2 );
  mitkWidget7->LayoutDesignListChanged( LAYOUT_WIDGET2 );

  //update Alle Widgets
  this->UpdateAllWidgets();
}

void QmitkStdMultiWidget::changeLayoutToWidget3()
{
  SMW_INFO << "changing layout to big Widget3 ..." << std::endl;

  //Hide all Menu Widgets
  this->HideAllWidgetToolbars();

  delete QmitkStdMultiWidgetLayout ;

  //create Main Layout
  QmitkStdMultiWidgetLayout =  new QHBoxLayout( this );

  //create main splitter
  m_MainSplit = new QSplitter( this );
  QmitkStdMultiWidgetLayout->addWidget( m_MainSplit );

  //add widget Splitter to main Splitter
  m_MainSplit->addWidget( mitkWidget3Container );

  //add LevelWindow Widget to mainSplitter
  m_MainSplit->addWidget( levelWindowWidget );

  //show mainSplitt and add to Layout
  m_MainSplit->show();

  //show/hide Widgets
  mitkWidget1Container->hide();
  mitkWidget2Container->hide();
  if ( mitkWidget3Container->isHidden() ) mitkWidget3Container->show();
  mitkWidget4Container->hide();
  mitkWidget5Container->hide();
  mitkWidget6Container->hide();
  mitkWidget7Container->hide();

  m_Layout = LAYOUT_WIDGET3;

  //update Layout Design List
  mitkWidget1->LayoutDesignListChanged( LAYOUT_WIDGET3 );
  mitkWidget2->LayoutDesignListChanged( LAYOUT_WIDGET3 );
  mitkWidget3->LayoutDesignListChanged( LAYOUT_WIDGET3 );
  mitkWidget4->LayoutDesignListChanged( LAYOUT_WIDGET3 );
  mitkWidget5->LayoutDesignListChanged( LAYOUT_WIDGET3 );
  mitkWidget6->LayoutDesignListChanged( LAYOUT_WIDGET3 );
  mitkWidget7->LayoutDesignListChanged( LAYOUT_WIDGET3 );

  //update Alle Widgets
  this->UpdateAllWidgets();
}

void QmitkStdMultiWidget::changeLayoutToRowWidget3And4()
{
  SMW_INFO << "changing layout to Widget3 and 4 in a Row..." << std::endl;

  //Hide all Menu Widgets
  this->HideAllWidgetToolbars();

  delete QmitkStdMultiWidgetLayout ;

  //create Main Layout
  QmitkStdMultiWidgetLayout =  new QHBoxLayout( this );

  //create main splitter
  m_MainSplit = new QSplitter( this );
  QmitkStdMultiWidgetLayout->addWidget( m_MainSplit );

  //create m_LayoutSplit  and add to the mainSplit
  m_LayoutSplit = new QSplitter( Qt::Vertical, m_MainSplit );
  m_MainSplit->addWidget( m_LayoutSplit );

  //add LevelWindow Widget to mainSplitter
  m_MainSplit->addWidget( levelWindowWidget );

  //add Widgets to splitter
  m_LayoutSplit->addWidget( mitkWidget3Container );
  m_LayoutSplit->addWidget( mitkWidget4Container );

  //set Splitter Size
  QList<int> splitterSize;
  splitterSize.push_back(1000);
  splitterSize.push_back(1000);
  m_LayoutSplit->setSizes( splitterSize );

  //show mainSplitt and add to Layout
  m_MainSplit->show();

  //show/hide Widgets
  mitkWidget1Container->hide();
  mitkWidget2Container->hide();
  if ( mitkWidget3Container->isHidden() ) mitkWidget3Container->show();
  if ( mitkWidget4Container->isHidden() ) mitkWidget4Container->show();
  mitkWidget5Container->hide();
  mitkWidget6Container->hide();
  mitkWidget7Container->hide();

  m_Layout = LAYOUT_ROW_WIDGET_3_AND_4;

  //update Layout Design List
  mitkWidget1->LayoutDesignListChanged( LAYOUT_ROW_WIDGET_3_AND_4 );
  mitkWidget2->LayoutDesignListChanged( LAYOUT_ROW_WIDGET_3_AND_4 );
  mitkWidget3->LayoutDesignListChanged( LAYOUT_ROW_WIDGET_3_AND_4 );
  mitkWidget4->LayoutDesignListChanged( LAYOUT_ROW_WIDGET_3_AND_4 );
  mitkWidget5->LayoutDesignListChanged( LAYOUT_ROW_WIDGET_3_AND_4 );
  mitkWidget6->LayoutDesignListChanged( LAYOUT_ROW_WIDGET_3_AND_4 );
  mitkWidget7->LayoutDesignListChanged( LAYOUT_ROW_WIDGET_3_AND_4 );

  //update Alle Widgets
  this->UpdateAllWidgets();
}

void QmitkStdMultiWidget::changeLayoutToColumnWidget3And4()
{
  SMW_INFO << "changing layout to Widget3 and 4 in one Column..." << std::endl;

  //Hide all Menu Widgets
  this->HideAllWidgetToolbars();

  delete QmitkStdMultiWidgetLayout ;

  //create Main Layout
  QmitkStdMultiWidgetLayout =  new QHBoxLayout( this );

  //create main splitter
  m_MainSplit = new QSplitter( this );
  QmitkStdMultiWidgetLayout->addWidget( m_MainSplit );

  //create m_LayoutSplit  and add to the mainSplit
  m_LayoutSplit = new QSplitter( m_MainSplit );
  m_MainSplit->addWidget( m_LayoutSplit );

  //add LevelWindow Widget to mainSplitter
  m_MainSplit->addWidget( levelWindowWidget );

  //add Widgets to splitter
  m_LayoutSplit->addWidget( mitkWidget3Container );
  m_LayoutSplit->addWidget( mitkWidget4Container );

  //set SplitterSize
  QList<int> splitterSize;
  splitterSize.push_back(1000);
  splitterSize.push_back(1000);
  m_LayoutSplit->setSizes( splitterSize );

  //show mainSplitt and add to Layout
  m_MainSplit->show();

  //show/hide Widgets
  mitkWidget1Container->hide();
  mitkWidget2Container->hide();
  if ( mitkWidget3Container->isHidden() ) mitkWidget3Container->show();
  if ( mitkWidget4Container->isHidden() ) mitkWidget4Container->show();
  mitkWidget5Container->hide();
  mitkWidget6Container->hide();
  mitkWidget7Container->hide();

  m_Layout = LAYOUT_COLUMN_WIDGET_3_AND_4;

  //update Layout Design List
  mitkWidget1->LayoutDesignListChanged( LAYOUT_COLUMN_WIDGET_3_AND_4 );
  mitkWidget2->LayoutDesignListChanged( LAYOUT_COLUMN_WIDGET_3_AND_4 );
  mitkWidget3->LayoutDesignListChanged( LAYOUT_COLUMN_WIDGET_3_AND_4 );
  mitkWidget4->LayoutDesignListChanged( LAYOUT_COLUMN_WIDGET_3_AND_4 );
  mitkWidget5->LayoutDesignListChanged( LAYOUT_COLUMN_WIDGET_3_AND_4 );
  mitkWidget6->LayoutDesignListChanged( LAYOUT_COLUMN_WIDGET_3_AND_4 );
  mitkWidget7->LayoutDesignListChanged( LAYOUT_COLUMN_WIDGET_3_AND_4 );

  //update Alle Widgets
  this->UpdateAllWidgets();
}

void QmitkStdMultiWidget::changeLayoutToRowWidgetSmall3andBig4()
{
  SMW_INFO << "changing layout to Widget3 and 4 in a Row..." << std::endl;

  this->changeLayoutToRowWidget3And4();

  m_Layout = LAYOUT_ROW_WIDGET_SMALL3_AND_BIG4;
}


void QmitkStdMultiWidget::changeLayoutToSmallUpperWidget2Big3and4()
{
  SMW_INFO << "changing layout to Widget3 and 4 in a Row..." << std::endl;

  //Hide all Menu Widgets
  this->HideAllWidgetToolbars();

  delete QmitkStdMultiWidgetLayout ;

  //create Main Layout
  QmitkStdMultiWidgetLayout =  new QHBoxLayout( this );

  //create main splitter
  m_MainSplit = new QSplitter( this );
  QmitkStdMultiWidgetLayout->addWidget( m_MainSplit );

  //create m_LayoutSplit  and add to the mainSplit
  m_LayoutSplit = new QSplitter( Qt::Vertical, m_MainSplit );
  m_MainSplit->addWidget( m_LayoutSplit );

  //add LevelWindow Widget to mainSplitter
  m_MainSplit->addWidget( levelWindowWidget );

  //create m_SubSplit1 and m_SubSplit2  
  m_SubSplit1 = new QSplitter( Qt::Vertical, m_LayoutSplit );
  m_SubSplit2 = new QSplitter( m_LayoutSplit );

  //insert Widget into the splitters
  m_SubSplit1->addWidget( mitkWidget2Container );

  m_SubSplit2->addWidget( mitkWidget3Container );
  m_SubSplit2->addWidget( mitkWidget4Container );

  //set Splitter Size
  QList<int> splitterSize;
  splitterSize.push_back(1000);
  splitterSize.push_back(1000);
  m_SubSplit2->setSizes( splitterSize );
  splitterSize.clear();
  splitterSize.push_back(500);
  splitterSize.push_back(1000);
  m_LayoutSplit->setSizes( splitterSize );

  //show mainSplitt
  m_MainSplit->show();

  //show Widget if hidden
  mitkWidget1Container->hide();
  if ( mitkWidget2Container->isHidden() ) mitkWidget2Container->show();
  if ( mitkWidget3Container->isHidden() ) mitkWidget3Container->show();
  if ( mitkWidget4Container->isHidden() ) mitkWidget4Container->show();
  mitkWidget5Container->hide();
  mitkWidget6Container->hide();
  mitkWidget7Container->hide();

  m_Layout = LAYOUT_SMALL_UPPER_WIDGET2_BIG3_AND4;

  //update Layout Design List
  mitkWidget1->LayoutDesignListChanged( LAYOUT_SMALL_UPPER_WIDGET2_BIG3_AND4 );
  mitkWidget2->LayoutDesignListChanged( LAYOUT_SMALL_UPPER_WIDGET2_BIG3_AND4 );
  mitkWidget3->LayoutDesignListChanged( LAYOUT_SMALL_UPPER_WIDGET2_BIG3_AND4 );
  mitkWidget4->LayoutDesignListChanged( LAYOUT_SMALL_UPPER_WIDGET2_BIG3_AND4 );
  mitkWidget5->LayoutDesignListChanged( LAYOUT_SMALL_UPPER_WIDGET2_BIG3_AND4 );
  mitkWidget6->LayoutDesignListChanged( LAYOUT_SMALL_UPPER_WIDGET2_BIG3_AND4 );
  mitkWidget7->LayoutDesignListChanged( LAYOUT_SMALL_UPPER_WIDGET2_BIG3_AND4 );

  //update Alle Widgets
  this->UpdateAllWidgets();
}


void QmitkStdMultiWidget::changeLayoutTo2x2Dand3DWidget()
{
  SMW_INFO << "changing layout to 2 x 2D and 3D Widget" << std::endl;

  //Hide all Menu Widgets
  this->HideAllWidgetToolbars();

  delete QmitkStdMultiWidgetLayout ;

  //create Main Layout
  QmitkStdMultiWidgetLayout =  new QHBoxLayout( this );

  //create main splitter
  m_MainSplit = new QSplitter( this );
  QmitkStdMultiWidgetLayout->addWidget( m_MainSplit );

  //create m_LayoutSplit  and add to the mainSplit
  m_LayoutSplit = new QSplitter( m_MainSplit );
  m_MainSplit->addWidget( m_LayoutSplit );

  //add LevelWindow Widget to mainSplitter
  m_MainSplit->addWidget( levelWindowWidget );

  //create m_SubSplit1 and m_SubSplit2  
  m_SubSplit1 = new QSplitter( Qt::Vertical, m_LayoutSplit );
  m_SubSplit2 = new QSplitter( m_LayoutSplit );

  //add Widgets to splitter
  m_SubSplit1->addWidget( mitkWidget1Container );
  m_SubSplit1->addWidget( mitkWidget2Container );
  m_SubSplit2->addWidget( mitkWidget4Container );

  //set Splitter Size
  QList<int> splitterSize;
  splitterSize.push_back(1000);
  splitterSize.push_back(1000);
  m_SubSplit1->setSizes( splitterSize );
  m_LayoutSplit->setSizes( splitterSize );

  //show mainSplitt and add to Layout
  m_MainSplit->show();

  //show/hide Widgets
  if ( mitkWidget1Container->isHidden() ) mitkWidget1Container->show();
  if ( mitkWidget2Container->isHidden() ) mitkWidget2Container->show();
  mitkWidget3Container->hide();
  if ( mitkWidget4Container->isHidden() ) mitkWidget4Container->show();
  mitkWidget5Container->hide();
  mitkWidget6Container->hide();
  mitkWidget7Container->hide();

  m_Layout = LAYOUT_2X_2D_AND_3D_WIDGET;

  //update Layout Design List
  mitkWidget1->LayoutDesignListChanged( LAYOUT_2X_2D_AND_3D_WIDGET );
  mitkWidget2->LayoutDesignListChanged( LAYOUT_2X_2D_AND_3D_WIDGET );
  mitkWidget3->LayoutDesignListChanged( LAYOUT_2X_2D_AND_3D_WIDGET );
  mitkWidget4->LayoutDesignListChanged( LAYOUT_2X_2D_AND_3D_WIDGET );
  mitkWidget5->LayoutDesignListChanged( LAYOUT_2X_2D_AND_3D_WIDGET );
  mitkWidget6->LayoutDesignListChanged( LAYOUT_2X_2D_AND_3D_WIDGET );
  mitkWidget7->LayoutDesignListChanged( LAYOUT_2X_2D_AND_3D_WIDGET );

  //update Alle Widgets
  this->UpdateAllWidgets();
}


void QmitkStdMultiWidget::changeLayoutToLeft2Dand3DRight2D()
{
  SMW_INFO << "changing layout to 2D and 3D left, 2D right Widget" << std::endl;

  //Hide all Menu Widgets
  this->HideAllWidgetToolbars();

  delete QmitkStdMultiWidgetLayout ;

  //create Main Layout
  QmitkStdMultiWidgetLayout =  new QHBoxLayout( this );

  //create main splitter
  m_MainSplit = new QSplitter( this );
  QmitkStdMultiWidgetLayout->addWidget( m_MainSplit );

  //create m_LayoutSplit  and add to the mainSplit
  m_LayoutSplit = new QSplitter( m_MainSplit );
  m_MainSplit->addWidget( m_LayoutSplit );

  //add LevelWindow Widget to mainSplitter
  m_MainSplit->addWidget( levelWindowWidget );

  //create m_SubSplit1 and m_SubSplit2  
  m_SubSplit1 = new QSplitter( Qt::Vertical, m_LayoutSplit );
  m_SubSplit2 = new QSplitter( m_LayoutSplit );


  //add Widgets to splitter
  m_SubSplit1->addWidget( mitkWidget1Container );
  m_SubSplit1->addWidget( mitkWidget4Container );
  m_SubSplit2->addWidget( mitkWidget2Container );

  //set Splitter Size
  QList<int> splitterSize;
  splitterSize.push_back(1000);
  splitterSize.push_back(1000);
  m_SubSplit1->setSizes( splitterSize );
  m_LayoutSplit->setSizes( splitterSize );

  //show mainSplitt and add to Layout
  m_MainSplit->show();

  //show/hide Widgets
  if ( mitkWidget1Container->isHidden() ) mitkWidget1Container->show();
  if ( mitkWidget2Container->isHidden() ) mitkWidget2Container->show();
  mitkWidget3Container->hide();
  if ( mitkWidget4Container->isHidden() ) mitkWidget4Container->show();
  mitkWidget5Container->hide();
  mitkWidget6Container->hide();
  mitkWidget7Container->hide();

  m_Layout = LAYOUT_2D_AND_3D_LEFT_2D_RIGHT_WIDGET;

  //update Layout Design List
  mitkWidget1->LayoutDesignListChanged( LAYOUT_2D_AND_3D_LEFT_2D_RIGHT_WIDGET );
  mitkWidget2->LayoutDesignListChanged( LAYOUT_2D_AND_3D_LEFT_2D_RIGHT_WIDGET );
  mitkWidget3->LayoutDesignListChanged( LAYOUT_2D_AND_3D_LEFT_2D_RIGHT_WIDGET );
  mitkWidget4->LayoutDesignListChanged( LAYOUT_2D_AND_3D_LEFT_2D_RIGHT_WIDGET );
  mitkWidget5->LayoutDesignListChanged( LAYOUT_2D_AND_3D_LEFT_2D_RIGHT_WIDGET );
  mitkWidget6->LayoutDesignListChanged( LAYOUT_2D_AND_3D_LEFT_2D_RIGHT_WIDGET );
  mitkWidget7->LayoutDesignListChanged( LAYOUT_2D_AND_3D_LEFT_2D_RIGHT_WIDGET );

  //update Alle Widgets
  this->UpdateAllWidgets();
}

void QmitkStdMultiWidget::changeLayoutTo2DUpAnd3DDown()
{
  SMW_INFO << "changing layout to 2D up and 3D down" << std::endl;

  //Hide all Menu Widgets
  this->HideAllWidgetToolbars();

  delete QmitkStdMultiWidgetLayout ;

  //create Main Layout
  QmitkStdMultiWidgetLayout =  new QHBoxLayout( this );

  //Set Layout to widget
  this->setLayout(QmitkStdMultiWidgetLayout);

  //create main splitter
  m_MainSplit = new QSplitter( this );
  QmitkStdMultiWidgetLayout->addWidget( m_MainSplit );

  //create m_LayoutSplit  and add to the mainSplit
  m_LayoutSplit = new QSplitter( Qt::Vertical, m_MainSplit );
  m_MainSplit->addWidget( m_LayoutSplit );

  //add LevelWindow Widget to mainSplitter
  m_MainSplit->addWidget( levelWindowWidget );

  //create m_SubSplit1 and m_SubSplit2  
  m_SubSplit1 = new QSplitter( m_LayoutSplit );
  m_SubSplit2 = new QSplitter( m_LayoutSplit );

  //insert Widget Container into splitter top
  m_SubSplit1->addWidget( mitkWidget1Container );

  //set SplitterSize for splitter top
   QList<int> splitterSize;
//   splitterSize.push_back(1000);
//   splitterSize.push_back(1000);
//   splitterSize.push_back(1000);
//   m_SubSplit1->setSizes( splitterSize );

  //insert Widget Container into splitter bottom
  m_SubSplit2->addWidget( mitkWidget4Container );

  //set SplitterSize for splitter m_LayoutSplit
  splitterSize.clear();
  splitterSize.push_back(700);
  splitterSize.push_back(700);
  m_LayoutSplit->setSizes( splitterSize );

  //show mainSplitt
  m_MainSplit->show();

  //show/hide Widgets
  if ( mitkWidget1Container->isHidden() ) mitkWidget1Container->show();
  mitkWidget2Container->hide();
  mitkWidget3Container->hide();
  if ( mitkWidget4Container->isHidden() ) mitkWidget4Container->show();
  mitkWidget5Container->hide();
  mitkWidget6Container->hide();
  mitkWidget7Container->hide();

  m_Layout = LAYOUT_2D_UP_AND_3D_DOWN;

  //update Layout Design List
  mitkWidget1->LayoutDesignListChanged( LAYOUT_2D_UP_AND_3D_DOWN );
  mitkWidget2->LayoutDesignListChanged( LAYOUT_2D_UP_AND_3D_DOWN );
  mitkWidget3->LayoutDesignListChanged( LAYOUT_2D_UP_AND_3D_DOWN );
  mitkWidget4->LayoutDesignListChanged( LAYOUT_2D_UP_AND_3D_DOWN );
  mitkWidget5->LayoutDesignListChanged( LAYOUT_2D_UP_AND_3D_DOWN );
  mitkWidget6->LayoutDesignListChanged( LAYOUT_2D_UP_AND_3D_DOWN );
  mitkWidget7->LayoutDesignListChanged( LAYOUT_2D_UP_AND_3D_DOWN );

  //update all Widgets
  this->UpdateAllWidgets();
}

void QmitkStdMultiWidget::changeLayoutTo5ViewMode()
{
  SMW_INFO << "changing layout to 5 view mode... " << std::endl;

  //Hide all Menu Widgets
  this->HideAllWidgetToolbars();

  delete QmitkStdMultiWidgetLayout ;

  //create Main Layout
  QmitkStdMultiWidgetLayout =  new QHBoxLayout( this );

  //Set Layout to widget
  this->setLayout(QmitkStdMultiWidgetLayout);

  //create main splitter
  m_MainSplit = new QSplitter( this );
  QmitkStdMultiWidgetLayout->addWidget( m_MainSplit );

  //create m_LayoutSplit  and add to the mainSplit
  m_LayoutSplit = new QSplitter( m_MainSplit );
  m_MainSplit->addWidget( m_LayoutSplit );

  //add LevelWindow Widget to mainSplitter
  m_MainSplit->addWidget( levelWindowWidget );

  //create m_SubSplit1 and m_SubSplit2
  m_SubSplit1 = new QSplitter( Qt::Vertical,m_LayoutSplit );
  m_SubSplit2 = new QSplitter( Qt::Vertical,m_LayoutSplit );

  //insert Widget Container into splitter top
  m_SubSplit1->addWidget( mitkWidget1Container );
  m_SubSplit1->addWidget( mitkWidget2Container );
  m_SubSplit1->addWidget( mitkWidget3Container );

  //set SplitterSize for splitter top
  QList<int> splitterSize;
  splitterSize.push_back(1000);
  splitterSize.push_back(1000);
  splitterSize.push_back(1000);
  m_SubSplit1->setSizes( splitterSize );

  //insert Widget Container into splitter bottom
  m_SubSplit2->addWidget( mitkWidget4Container );
  m_SubSplit2->addWidget( mitkWidget5Container );

  //set SplitterSize for splitter m_LayoutSplit
  splitterSize.clear();
  splitterSize.push_back(1000);
  splitterSize.push_back(1000);
  m_SubSplit2->setSizes(splitterSize);

  splitterSize.clear();
  splitterSize.push_back(400);
  splitterSize.push_back(1000);
  m_LayoutSplit->setSizes( splitterSize );

  //show mainSplitt
  m_MainSplit->show();

  //show Widget if hidden
  if ( mitkWidget1Container->isHidden() ) mitkWidget1Container->show();
  if ( mitkWidget2Container->isHidden() ) mitkWidget2Container->show();
  if ( mitkWidget3Container->isHidden() ) mitkWidget3Container->show();
  if ( mitkWidget4Container->isHidden() ) mitkWidget4Container->show();
  if ( mitkWidget5Container->isHidden() ) mitkWidget5Container->show();
  mitkWidget6Container->hide();
  mitkWidget7Container->hide();

  //Change Layout Name
  m_Layout = LAYOUT_5VIEWMODE;

  //update Layout Design List
  mitkWidget1->LayoutDesignListChanged( LAYOUT_5VIEWMODE );
  mitkWidget2->LayoutDesignListChanged( LAYOUT_5VIEWMODE );
  mitkWidget3->LayoutDesignListChanged( LAYOUT_5VIEWMODE );
  mitkWidget4->LayoutDesignListChanged( LAYOUT_5VIEWMODE );
  mitkWidget5->LayoutDesignListChanged( LAYOUT_5VIEWMODE );
  mitkWidget6->LayoutDesignListChanged( LAYOUT_5VIEWMODE );
  mitkWidget7->LayoutDesignListChanged( LAYOUT_5VIEWMODE );

  //update Alle Widgets
  this->UpdateAllWidgets();
}

void QmitkStdMultiWidget::changeLayoutTo6ViewMode()
{
  SMW_INFO << "changing layout to 6 view mode... " << std::endl;

  //Hide all Menu Widgets
  this->HideAllWidgetToolbars();

  delete QmitkStdMultiWidgetLayout ;

  //create Main Layout
  QmitkStdMultiWidgetLayout =  new QHBoxLayout( this );

  //Set Layout to widget
  this->setLayout(QmitkStdMultiWidgetLayout);

  //create main splitter
  m_MainSplit = new QSplitter( this );
  QmitkStdMultiWidgetLayout->addWidget( m_MainSplit );

  //create m_LayoutSplit  and add to the mainSplit
  m_LayoutSplit = new QSplitter( m_MainSplit );
  m_MainSplit->addWidget( m_LayoutSplit );

  //add LevelWindow Widget to mainSplitter
  m_MainSplit->addWidget( levelWindowWidget );

  //create m_SubSplit1 and m_SubSplit2
  m_SubSplit1 = new QSplitter( Qt::Vertical,m_LayoutSplit );
  m_SubSplit2 = new QSplitter( Qt::Vertical,m_LayoutSplit );

  //insert Widget Container into splitter top
  m_SubSplit1->addWidget( mitkWidget1Container );
  m_SubSplit1->addWidget( mitkWidget2Container );
  m_SubSplit1->addWidget( mitkWidget3Container );

  //set SplitterSize for splitter top
  QList<int> splitterSize;
  splitterSize.push_back(1000);
  splitterSize.push_back(1000);
  splitterSize.push_back(1000);
  m_SubSplit1->setSizes( splitterSize );

  m_SubSplit21 = new QSplitter( m_SubSplit2 );
  m_SubSplit22 = new QSplitter( m_SubSplit2 );

  //insert Widget Container into splitter bottom
  m_SubSplit21->addWidget( mitkWidget4Container );
  m_SubSplit22->addWidget( mitkWidget5Container );
  m_SubSplit22->addWidget( mitkWidget6Container );

  splitterSize.clear();
  splitterSize.push_back(1000);
  splitterSize.push_back(1000);
  m_SubSplit2->setSizes( splitterSize );
  m_SubSplit22->setSizes( splitterSize );

  //set SplitterSize for splitter m_LayoutSplit
  splitterSize.clear();
  splitterSize.push_back(400);
  splitterSize.push_back(1000);
  m_LayoutSplit->setSizes( splitterSize );

  //show mainSplitt
  m_MainSplit->show();

  //show Widget if hidden
  if ( mitkWidget1Container->isHidden() ) mitkWidget1Container->show();
  if ( mitkWidget2Container->isHidden() ) mitkWidget2Container->show();
  if ( mitkWidget3Container->isHidden() ) mitkWidget3Container->show();
  if ( mitkWidget4Container->isHidden() ) mitkWidget4Container->show();
  if ( mitkWidget5Container->isHidden() ) mitkWidget5Container->show();
  if ( mitkWidget6Container->isHidden() ) mitkWidget6Container->show();
  mitkWidget7Container->hide();

  //Change Layout Name
  m_Layout = LAYOUT_6VIEWMODE;

  //update Layout Design List
  mitkWidget1->LayoutDesignListChanged( LAYOUT_6VIEWMODE );
  mitkWidget2->LayoutDesignListChanged( LAYOUT_6VIEWMODE );
  mitkWidget3->LayoutDesignListChanged( LAYOUT_6VIEWMODE );
  mitkWidget4->LayoutDesignListChanged( LAYOUT_6VIEWMODE );
  mitkWidget5->LayoutDesignListChanged( LAYOUT_6VIEWMODE );
  mitkWidget6->LayoutDesignListChanged( LAYOUT_6VIEWMODE );
  mitkWidget7->LayoutDesignListChanged( LAYOUT_6VIEWMODE );

  //update Alle Widgets
  this->UpdateAllWidgets();
}

void QmitkStdMultiWidget::changeLayoutTo7ViewMode()
{
  SMW_INFO << "changing layout to 7 view mode... " << std::endl;

  //Hide all Menu Widgets
  this->HideAllWidgetToolbars();

  delete QmitkStdMultiWidgetLayout ;

  //create Main Layout
  QmitkStdMultiWidgetLayout =  new QHBoxLayout( this );

  //Set Layout to widget
  this->setLayout(QmitkStdMultiWidgetLayout);

  //create main splitter
  m_MainSplit = new QSplitter( this );
  QmitkStdMultiWidgetLayout->addWidget( m_MainSplit );

  //create m_LayoutSplit  and add to the mainSplit
  m_LayoutSplit = new QSplitter( Qt::Horizontal, m_MainSplit );
  m_MainSplit->addWidget( m_LayoutSplit );

  //add LevelWindow Widget to mainSplitter
  m_MainSplit->addWidget( levelWindowWidget );

  //create m_SubSplit1 and m_SubSplit2
  m_SubSplit1 = new QSplitter( Qt::Vertical,m_LayoutSplit );
  m_SubSplit2 = new QSplitter( Qt::Vertical,m_LayoutSplit );

  //insert Widget Container into splitter top
  m_SubSplit1->addWidget( mitkWidget1Container );
  m_SubSplit1->addWidget( mitkWidget2Container );
  m_SubSplit1->addWidget( mitkWidget3Container );

  //set SplitterSize for splitter top
  QList<int> splitterSize;
  splitterSize.push_back(1000);
  splitterSize.push_back(1000);
  splitterSize.push_back(1000);
  m_SubSplit1->setSizes( splitterSize );

  m_SubSplit21 = new QSplitter( m_SubSplit2 );
  m_SubSplit22 = new QSplitter( m_SubSplit2 );

  //insert Widget Container into splitter bottom
  m_SubSplit21->addWidget( mitkWidget4Container );
  m_SubSplit21->addWidget( mitkWidget5Container );
  m_SubSplit22->addWidget( mitkWidget6Container );
  m_SubSplit22->addWidget( mitkWidget7Container );

  splitterSize.clear();
  splitterSize.push_back(1000);
  splitterSize.push_back(1000);
  m_SubSplit21->setSizes( splitterSize );
  m_SubSplit22->setSizes( splitterSize );

  //set SplitterSize for splitter m_LayoutSplit
  splitterSize.clear();
  splitterSize.push_back(400);
  splitterSize.push_back(1000);
  m_LayoutSplit->setSizes( splitterSize );

  //show mainSplitt
  m_MainSplit->show();

  //show Widget if hidden
  if ( mitkWidget1Container->isHidden() ) mitkWidget1Container->show();
  if ( mitkWidget2Container->isHidden() ) mitkWidget2Container->show();
  if ( mitkWidget3Container->isHidden() ) mitkWidget3Container->show();
  if ( mitkWidget4Container->isHidden() ) mitkWidget4Container->show();
  if ( mitkWidget5Container->isHidden() ) mitkWidget5Container->show();
  if ( mitkWidget6Container->isHidden() ) mitkWidget6Container->show();
  if ( mitkWidget7Container->isHidden() ) mitkWidget7Container->show();
  //Change Layout Name
  m_Layout = LAYOUT_7VIEWMODE;

  //update Layout Design List
  mitkWidget1->LayoutDesignListChanged( LAYOUT_7VIEWMODE );
  mitkWidget2->LayoutDesignListChanged( LAYOUT_7VIEWMODE );
  mitkWidget3->LayoutDesignListChanged( LAYOUT_7VIEWMODE );
  mitkWidget4->LayoutDesignListChanged( LAYOUT_7VIEWMODE );
  mitkWidget5->LayoutDesignListChanged( LAYOUT_7VIEWMODE );
  mitkWidget6->LayoutDesignListChanged( LAYOUT_7VIEWMODE );
  mitkWidget7->LayoutDesignListChanged( LAYOUT_7VIEWMODE );

  //update Alle Widgets
  this->UpdateAllWidgets();
}

void QmitkStdMultiWidget::changeLayoutToWidget5()
{
  SMW_INFO << "changing layout to widget5 ..." << std::endl;

  //Hide all Menu Widgets
  this->HideAllWidgetToolbars();

  delete QmitkStdMultiWidgetLayout ;

  //create Main Layout
  QmitkStdMultiWidgetLayout =  new QHBoxLayout( this );

  //create main splitter
  m_MainSplit = new QSplitter( this );
  QmitkStdMultiWidgetLayout->addWidget( m_MainSplit );

  //add widget Splitter to main Splitter
  m_MainSplit->addWidget( mitkWidget5Container );

  //add LevelWindow Widget to mainSplitter
  m_MainSplit->addWidget( levelWindowWidget );

  //show mainSplitt and add to Layout
  m_MainSplit->show();

  //show/hide Widgets
  mitkWidget1Container->hide();
  mitkWidget2Container->hide();
  mitkWidget3Container->hide();
  mitkWidget4Container->hide();
  if ( mitkWidget5Container->isHidden() ) mitkWidget5Container->show();
  mitkWidget6Container->hide();
  mitkWidget7Container->hide();

  m_Layout = LAYOUT_WIDGET5;

  //update Layout Design List
  mitkWidget1->LayoutDesignListChanged( LAYOUT_WIDGET5 );
  mitkWidget2->LayoutDesignListChanged( LAYOUT_WIDGET5 );
  mitkWidget3->LayoutDesignListChanged( LAYOUT_WIDGET5 );
  mitkWidget4->LayoutDesignListChanged( LAYOUT_WIDGET5 );
  mitkWidget5->LayoutDesignListChanged( LAYOUT_WIDGET5 );
  mitkWidget6->LayoutDesignListChanged( LAYOUT_WIDGET5 );
  mitkWidget7->LayoutDesignListChanged( LAYOUT_WIDGET5 );

  //update Alle Widgets
  this->UpdateAllWidgets();
}

void QmitkStdMultiWidget::changeLayoutToWidget6()
{
  SMW_INFO << "changing layout to widget6 ..." << std::endl;

  //Hide all Menu Widgets
  this->HideAllWidgetToolbars();

  delete QmitkStdMultiWidgetLayout ;

  //create Main Layout
  QmitkStdMultiWidgetLayout =  new QHBoxLayout( this );

  //create main splitter
  m_MainSplit = new QSplitter( this );
  QmitkStdMultiWidgetLayout->addWidget( m_MainSplit );

  //add widget Splitter to main Splitter
  m_MainSplit->addWidget( mitkWidget6Container );

  //add LevelWindow Widget to mainSplitter
  m_MainSplit->addWidget( levelWindowWidget );

  //show mainSplitt and add to Layout
  m_MainSplit->show();

  //show/hide Widgets
  mitkWidget1Container->hide();
  mitkWidget2Container->hide();
  mitkWidget3Container->hide();
  mitkWidget4Container->hide();
  mitkWidget5Container->hide();
  if ( mitkWidget6Container->isHidden() ) mitkWidget6Container->show();
  mitkWidget7Container->hide();

  m_Layout = LAYOUT_WIDGET6;

  //update Layout Design List
  mitkWidget1->LayoutDesignListChanged( LAYOUT_WIDGET6 );
  mitkWidget2->LayoutDesignListChanged( LAYOUT_WIDGET6 );
  mitkWidget3->LayoutDesignListChanged( LAYOUT_WIDGET6 );
  mitkWidget4->LayoutDesignListChanged( LAYOUT_WIDGET6 );
  mitkWidget5->LayoutDesignListChanged( LAYOUT_WIDGET6 );
  mitkWidget6->LayoutDesignListChanged( LAYOUT_WIDGET6 );
  mitkWidget7->LayoutDesignListChanged( LAYOUT_WIDGET6 );

  //update Alle Widgets
  this->UpdateAllWidgets();
}

void QmitkStdMultiWidget::changeLayoutToWidget7()
{
  SMW_INFO << "changing layout to widget7 ..." << std::endl;

  //Hide all Menu Widgets
  this->HideAllWidgetToolbars();

  delete QmitkStdMultiWidgetLayout ;

  //create Main Layout
  QmitkStdMultiWidgetLayout =  new QHBoxLayout( this );

  //create main splitter
  m_MainSplit = new QSplitter( this );
  QmitkStdMultiWidgetLayout->addWidget( m_MainSplit );

  //add widget Splitter to main Splitter
  m_MainSplit->addWidget( mitkWidget7Container );

  //add LevelWindow Widget to mainSplitter
  m_MainSplit->addWidget( levelWindowWidget );

  //show mainSplitt and add to Layout
  m_MainSplit->show();

  //show/hide Widgets
  mitkWidget1Container->hide();
  mitkWidget2Container->hide();
  mitkWidget3Container->hide();
  mitkWidget4Container->hide();
  mitkWidget5Container->hide();
  mitkWidget6Container->hide();
  if ( mitkWidget7Container->isHidden() ) mitkWidget7Container->show();

  m_Layout = LAYOUT_WIDGET7;

  //update Layout Design List
  mitkWidget1->LayoutDesignListChanged( LAYOUT_WIDGET7 );
  mitkWidget2->LayoutDesignListChanged( LAYOUT_WIDGET7 );
  mitkWidget3->LayoutDesignListChanged( LAYOUT_WIDGET7 );
  mitkWidget4->LayoutDesignListChanged( LAYOUT_WIDGET7 );
  mitkWidget5->LayoutDesignListChanged( LAYOUT_WIDGET7 );
  mitkWidget6->LayoutDesignListChanged( LAYOUT_WIDGET7 );
  mitkWidget7->LayoutDesignListChanged( LAYOUT_WIDGET7 );

  //update Alle Widgets
  this->UpdateAllWidgets();
}

void QmitkStdMultiWidget::SetDataStorage( mitk::DataStorage* ds )
{
  mitk::BaseRenderer::GetInstance(mitkWidget1->GetRenderWindow())->SetDataStorage(ds);
  mitk::BaseRenderer::GetInstance(mitkWidget2->GetRenderWindow())->SetDataStorage(ds);
  mitk::BaseRenderer::GetInstance(mitkWidget3->GetRenderWindow())->SetDataStorage(ds);
  mitk::BaseRenderer::GetInstance(mitkWidget4->GetRenderWindow())->SetDataStorage(ds);
  mitk::BaseRenderer::GetInstance(mitkWidget7->GetRenderWindow())->SetDataStorage(ds);
  m_DataStorage = ds;
}


void QmitkStdMultiWidget::Fit()
{
  vtkRenderer * vtkrenderer;
  mitk::BaseRenderer::GetInstance(mitkWidget1->GetRenderWindow())->GetDisplayGeometry()->Fit();
  mitk::BaseRenderer::GetInstance(mitkWidget2->GetRenderWindow())->GetDisplayGeometry()->Fit();
  mitk::BaseRenderer::GetInstance(mitkWidget3->GetRenderWindow())->GetDisplayGeometry()->Fit();
  mitk::BaseRenderer::GetInstance(mitkWidget4->GetRenderWindow())->GetDisplayGeometry()->Fit();

  int w = vtkObject::GetGlobalWarningDisplay();
  vtkObject::GlobalWarningDisplayOff();

  vtkrenderer = mitk::BaseRenderer::GetInstance(mitkWidget1->GetRenderWindow())->GetVtkRenderer();
  if ( vtkrenderer!= NULL ) 
    vtkrenderer->ResetCamera();

  vtkrenderer = mitk::BaseRenderer::GetInstance(mitkWidget2->GetRenderWindow())->GetVtkRenderer();
  if ( vtkrenderer!= NULL ) 
    vtkrenderer->ResetCamera();

  vtkrenderer = mitk::BaseRenderer::GetInstance(mitkWidget3->GetRenderWindow())->GetVtkRenderer();
  if ( vtkrenderer!= NULL ) 
    vtkrenderer->ResetCamera();

  //vtkrenderer = mitk::BaseRenderer::GetInstance(mitkWidget4->GetRenderWindow())->GetVtkRenderer();
  //if ( vtkrenderer!= NULL )
  //  vtkrenderer->ResetCamera();

  vtkObject::SetGlobalWarningDisplay(w);
}


void QmitkStdMultiWidget::InitPositionTracking()
{
  //PoinSetNode for MouseOrientation
  m_PositionTrackerNode = mitk::DataNode::New();
  m_PositionTrackerNode->SetProperty("name", mitk::StringProperty::New("Mouse Position"));
  m_PositionTrackerNode->SetData( mitk::PointSet::New() );
  m_PositionTrackerNode->SetColor(1.0,0.33,0.0);
  m_PositionTrackerNode->SetProperty("layer", mitk::IntProperty::New(1001));
  m_PositionTrackerNode->SetVisibility(true);
  m_PositionTrackerNode->SetProperty("inputdevice", mitk::BoolProperty::New(true) );
  m_PositionTrackerNode->SetProperty("BaseRendererMapperID", mitk::IntProperty::New(0) );//point position 2D mouse
  m_PositionTrackerNode->SetProperty("baserenderer", mitk::StringProperty::New("N/A"));
}


void QmitkStdMultiWidget::AddDisplayPlaneSubTree()
{
  // add the displayed planes of the multiwidget to a node to which the subtree 
  // @a planesSubTree points ...

  float white[3] = {1.0f,1.0f,1.0f};
  mitk::Geometry2DDataMapper2D::Pointer mapper;

  // ... of widget 1
  m_PlaneNode1 = (mitk::BaseRenderer::GetInstance(mitkWidget1->GetRenderWindow()))->GetCurrentWorldGeometry2DNode();
  m_PlaneNode1->SetColor(white, mitk::BaseRenderer::GetInstance(mitkWidget4->GetRenderWindow()));
  m_PlaneNode1->SetProperty("visible", mitk::BoolProperty::New(true));
  m_PlaneNode1->SetProperty("name", mitk::StringProperty::New("widget1Plane"));
  m_PlaneNode1->SetProperty("includeInBoundingBox", mitk::BoolProperty::New(false));
  m_PlaneNode1->SetProperty("helper object", mitk::BoolProperty::New(true));
  mapper = mitk::Geometry2DDataMapper2D::New();
  m_PlaneNode1->SetMapper(mitk::BaseRenderer::Standard2D, mapper);

  // ... of widget 2
  m_PlaneNode2 =( mitk::BaseRenderer::GetInstance(mitkWidget2->GetRenderWindow()))->GetCurrentWorldGeometry2DNode();
  m_PlaneNode2->SetColor(white, mitk::BaseRenderer::GetInstance(mitkWidget4->GetRenderWindow()));
  m_PlaneNode2->SetProperty("visible", mitk::BoolProperty::New(true));
  m_PlaneNode2->SetProperty("name", mitk::StringProperty::New("widget2Plane"));
  m_PlaneNode2->SetProperty("includeInBoundingBox", mitk::BoolProperty::New(false));
  m_PlaneNode2->SetProperty("helper object", mitk::BoolProperty::New(true));
  mapper = mitk::Geometry2DDataMapper2D::New();
  m_PlaneNode2->SetMapper(mitk::BaseRenderer::Standard2D, mapper);

  // ... of widget 3
  m_PlaneNode3 = (mitk::BaseRenderer::GetInstance(mitkWidget3->GetRenderWindow()))->GetCurrentWorldGeometry2DNode();
  m_PlaneNode3->SetColor(white, mitk::BaseRenderer::GetInstance(mitkWidget4->GetRenderWindow()));
  m_PlaneNode3->SetProperty("visible", mitk::BoolProperty::New(true));
  m_PlaneNode3->SetProperty("name", mitk::StringProperty::New("widget3Plane"));
  m_PlaneNode3->SetProperty("includeInBoundingBox", mitk::BoolProperty::New(false));
  m_PlaneNode3->SetProperty("helper object", mitk::BoolProperty::New(true));
  mapper = mitk::Geometry2DDataMapper2D::New();
  m_PlaneNode3->SetMapper(mitk::BaseRenderer::Standard2D, mapper);

  m_PlaneNode7 = (mitk::BaseRenderer::GetInstance(mitkWidget7->GetRenderWindow()))->GetCurrentWorldGeometry2DNode();
  m_PlaneNode7->SetColor(white, mitk::BaseRenderer::GetInstance(mitkWidget4->GetRenderWindow()));
  m_PlaneNode7->SetProperty("visible", mitk::BoolProperty::New(true));
  m_PlaneNode7->SetProperty("name", mitk::StringProperty::New("widget7Plane"));
  m_PlaneNode7->SetProperty("includeInBoundingBox", mitk::BoolProperty::New(false));
  m_PlaneNode7->SetProperty("helper object", mitk::BoolProperty::New(true));
  mapper = mitk::Geometry2DDataMapper2D::New();
  m_PlaneNode7->SetMapper(mitk::BaseRenderer::Standard2D, mapper);

  m_Node = mitk::DataNode::New();
  m_Node->SetProperty("name", mitk::StringProperty::New("Widgets"));
  m_Node->SetProperty("helper object", mitk::BoolProperty::New(true));
}


mitk::SliceNavigationController* QmitkStdMultiWidget::GetTimeNavigationController()
{
  return m_TimeNavigationController.GetPointer();
}


void QmitkStdMultiWidget::EnableStandardLevelWindow()
{
  levelWindowWidget->disconnect(this);
  levelWindowWidget->SetDataStorage(mitk::BaseRenderer::GetInstance(mitkWidget1->GetRenderWindow())->GetDataStorage());
  levelWindowWidget->show();
}


void QmitkStdMultiWidget::DisableStandardLevelWindow()
{
  levelWindowWidget->disconnect(this);
  levelWindowWidget->hide();
}


// CAUTION: Legacy code for enabling Qt-signal-controlled view initialization.
// Use RenderingManager::InitializeViews() instead.
bool QmitkStdMultiWidget::InitializeStandardViews( const mitk::Geometry3D * geometry )
{
  return mitk::RenderingManager::GetInstance()->InitializeViews( geometry );
}


void QmitkStdMultiWidget::RequestUpdate()
{
  mitk::RenderingManager::GetInstance()->RequestUpdate(mitkWidget1->GetRenderWindow());
  mitk::RenderingManager::GetInstance()->RequestUpdate(mitkWidget2->GetRenderWindow());
  mitk::RenderingManager::GetInstance()->RequestUpdate(mitkWidget3->GetRenderWindow());
  mitk::RenderingManager::GetInstance()->RequestUpdate(mitkWidget4->GetRenderWindow());
  mitk::RenderingManager::GetInstance()->RequestUpdate(mitkWidget5->GetRenderWindow());
}


void QmitkStdMultiWidget::ForceImmediateUpdate()
{
  mitk::RenderingManager::GetInstance()->ForceImmediateUpdate(mitkWidget1->GetRenderWindow());
  mitk::RenderingManager::GetInstance()->ForceImmediateUpdate(mitkWidget2->GetRenderWindow());
  mitk::RenderingManager::GetInstance()->ForceImmediateUpdate(mitkWidget3->GetRenderWindow());
  mitk::RenderingManager::GetInstance()->ForceImmediateUpdate(mitkWidget4->GetRenderWindow());
  mitk::RenderingManager::GetInstance()->ForceImmediateUpdate(mitkWidget5->GetRenderWindow());
}


void QmitkStdMultiWidget::wheelEvent( QWheelEvent * e )
{
  emit WheelMoved( e );
}

void QmitkStdMultiWidget::mousePressEvent(QMouseEvent * e)
{
   if (e->button() == Qt::LeftButton) {
       mitk::Point3D pointValue = this->GetLastLeftClickPosition();
       emit LeftMouseClicked(pointValue); 
   }
}

void QmitkStdMultiWidget::moveEvent( QMoveEvent* e )
{
  QWidget::moveEvent( e );
  
  // it is necessary to readjust the position of the overlays as the StdMultiWidget has moved
  // unfortunately it's not done by QmitkRenderWindow::moveEvent -> must be done here
  emit Moved();
}

void QmitkStdMultiWidget::leaveEvent ( QEvent * /*e*/  )
{
  //set cursor back to initial state
  m_SlicesRotator->ResetMouseCursor();
}

mitk::DisplayVectorInteractor* QmitkStdMultiWidget::GetMoveAndZoomInteractor()
{
  return m_MoveAndZoomInteractor.GetPointer();
}


QmitkRenderWindow* QmitkStdMultiWidget::GetRenderWindow1() const
{
  return mitkWidget1;
}


QmitkRenderWindow* QmitkStdMultiWidget::GetRenderWindow2() const
{
  return mitkWidget2;
}


QmitkRenderWindow* QmitkStdMultiWidget::GetRenderWindow3() const
{
  return mitkWidget3;
}


QmitkRenderWindow* QmitkStdMultiWidget::GetRenderWindow4() const
{
  return mitkWidget4;
}

QmitkRenderWindow* QmitkStdMultiWidget::GetRenderWindow5() const
{
  return mitkWidget5;
}

QmitkRenderWindow* QmitkStdMultiWidget::GetRenderWindow6() const
{
  return mitkWidget6;
}

QmitkRenderWindow* QmitkStdMultiWidget::GetRenderWindow7() const
{
  return mitkWidget7;
}

const mitk::Point3D& QmitkStdMultiWidget::GetLastLeftClickPosition() const
{
  return m_LastLeftClickPositionSupplier->GetCurrentPoint();
}


const mitk::Point3D QmitkStdMultiWidget::GetCrossPosition() const
{
  const mitk::PlaneGeometry *plane1 =
    mitkWidget1->GetSliceNavigationController()->GetCurrentPlaneGeometry();
  const mitk::PlaneGeometry *plane2 =
    mitkWidget2->GetSliceNavigationController()->GetCurrentPlaneGeometry();
  const mitk::PlaneGeometry *plane3 =
    mitkWidget3->GetSliceNavigationController()->GetCurrentPlaneGeometry();

  mitk::Line3D line;
  if ( (plane1 != NULL) && (plane2 != NULL)
    && (plane1->IntersectionLine( plane2, line )) )
  {
    mitk::Point3D point;
    if ( (plane3 != NULL)
      && (plane3->IntersectionPoint( line, point )) )
    {
      return point;
    }
  }
  return m_LastLeftClickPositionSupplier->GetCurrentPoint();
}


void QmitkStdMultiWidget::EnablePositionTracking()
{
  if (!m_PositionTracker)
  {
    m_PositionTracker = mitk::PositionTracker::New("PositionTracker", NULL);
  }
  mitk::GlobalInteraction* globalInteraction = mitk::GlobalInteraction::GetInstance();
  if (globalInteraction)
  {
    if(m_DataStorage.IsNotNull())
      m_DataStorage->Add(m_PositionTrackerNode);
    globalInteraction->AddListener(m_PositionTracker);
  }
}


void QmitkStdMultiWidget::DisablePositionTracking()
{
  mitk::GlobalInteraction* globalInteraction =
    mitk::GlobalInteraction::GetInstance();

  if(globalInteraction)
  {
    if (m_DataStorage.IsNotNull())
      m_DataStorage->Remove(m_PositionTrackerNode);
    globalInteraction->RemoveListener(m_PositionTracker);
  }
}


void QmitkStdMultiWidget::EnsureDisplayContainsPoint(
  mitk::DisplayGeometry* displayGeometry, const mitk::Point3D& p)
{
  mitk::Point2D pointOnPlane;
  displayGeometry->Map( p, pointOnPlane );

  // point minus origin < width or height ==> outside ?
  mitk::Vector2D pointOnRenderWindow_MM;
  pointOnRenderWindow_MM = pointOnPlane.GetVectorFromOrigin()
    - displayGeometry->GetOriginInMM();

  mitk::Vector2D sizeOfDisplay( displayGeometry->GetSizeInMM() );

  if (   sizeOfDisplay[0] < pointOnRenderWindow_MM[0]
  ||                0 > pointOnRenderWindow_MM[0]
  || sizeOfDisplay[1] < pointOnRenderWindow_MM[1]
  ||                0 > pointOnRenderWindow_MM[1] )
  {
    // point is not visible -> move geometry
    mitk::Vector2D offset( (pointOnRenderWindow_MM - sizeOfDisplay / 2.0)
      / displayGeometry->GetScaleFactorMMPerDisplayUnit() );

    displayGeometry->MoveBy( offset );
  }
}


void QmitkStdMultiWidget::MoveCrossToPosition(const mitk::Point3D& newPosition)
{
  // create a PositionEvent with the given position and
  // tell the slice navigation controllers to move there

  mitk::Point2D p2d;
  mitk::PositionEvent event( mitk::BaseRenderer::GetInstance(mitkWidget1->GetRenderWindow()), 0, 0, 0,
    mitk::Key_unknown, p2d, newPosition );
  mitk::StateEvent stateEvent(mitk::EIDLEFTMOUSEBTN, &event);
  mitk::StateEvent stateEvent2(mitk::EIDLEFTMOUSERELEASE, &event);

  switch ( m_PlaneMode )
  {
  default:
  case PLANE_MODE_SLICING:
    mitkWidget1->GetSliceNavigationController()->HandleEvent( &stateEvent );
    mitkWidget2->GetSliceNavigationController()->HandleEvent( &stateEvent );
    mitkWidget3->GetSliceNavigationController()->HandleEvent( &stateEvent );

    // just in case SNCs will develop something that depends on the mouse
    // button being released again
    mitkWidget1->GetSliceNavigationController()->HandleEvent( &stateEvent2 );
    mitkWidget2->GetSliceNavigationController()->HandleEvent( &stateEvent2 );
    mitkWidget3->GetSliceNavigationController()->HandleEvent( &stateEvent2 );
    break;

  case PLANE_MODE_ROTATION:
    m_SlicesRotator->HandleEvent( &stateEvent );

    // just in case SNCs will develop something that depends on the mouse
    // button being released again
    m_SlicesRotator->HandleEvent( &stateEvent2 );
    break;

  case PLANE_MODE_SWIVEL:
    m_SlicesSwiveller->HandleEvent( &stateEvent );

    // just in case SNCs will develop something that depends on the mouse
    // button being released again
    m_SlicesSwiveller->HandleEvent( &stateEvent2 );
    break;
  }

  // determine if cross is now out of display
  // if so, move the display window
  EnsureDisplayContainsPoint( mitk::BaseRenderer::GetInstance(mitkWidget1->GetRenderWindow())
    ->GetDisplayGeometry(), newPosition );
  EnsureDisplayContainsPoint( mitk::BaseRenderer::GetInstance(mitkWidget2->GetRenderWindow())
    ->GetDisplayGeometry(), newPosition );
  EnsureDisplayContainsPoint( mitk::BaseRenderer::GetInstance(mitkWidget3->GetRenderWindow())
    ->GetDisplayGeometry(), newPosition );

  // update displays
  mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}


void QmitkStdMultiWidget::EnableNavigationControllerEventListening()
{
  // Let NavigationControllers listen to GlobalInteraction
  mitk::GlobalInteraction *gi = mitk::GlobalInteraction::GetInstance();

  switch ( m_PlaneMode )
  {
  default:
  case PLANE_MODE_SLICING:
    gi->AddListener( mitkWidget1->GetSliceNavigationController() );
    gi->AddListener( mitkWidget2->GetSliceNavigationController() );
    gi->AddListener( mitkWidget3->GetSliceNavigationController() );
    gi->AddListener( mitkWidget4->GetSliceNavigationController() );
    break;

  case PLANE_MODE_ROTATION:
    gi->AddListener( m_SlicesRotator );
    break;

  case PLANE_MODE_SWIVEL:
    gi->AddListener( m_SlicesSwiveller );
    break;
  }

  gi->AddListener( m_TimeNavigationController );
}

void QmitkStdMultiWidget::DisableNavigationControllerEventListening()
{
  // Do not let NavigationControllers listen to GlobalInteraction
  mitk::GlobalInteraction *gi = mitk::GlobalInteraction::GetInstance();

  switch ( m_PlaneMode )
  {
  default:
  case PLANE_MODE_SLICING:
    gi->RemoveListener( mitkWidget1->GetSliceNavigationController() );
    gi->RemoveListener( mitkWidget2->GetSliceNavigationController() );
    gi->RemoveListener( mitkWidget3->GetSliceNavigationController() );
    gi->RemoveListener( mitkWidget4->GetSliceNavigationController() );
    break;

  case PLANE_MODE_ROTATION:
    m_SlicesRotator->ResetMouseCursor();
    gi->RemoveListener( m_SlicesRotator );
    break;

  case PLANE_MODE_SWIVEL:
    m_SlicesSwiveller->ResetMouseCursor();
    gi->RemoveListener( m_SlicesSwiveller );
    break;
  }

  gi->RemoveListener( m_TimeNavigationController );
}


int QmitkStdMultiWidget::GetLayout() const
{
  return m_Layout;
}


void QmitkStdMultiWidget::EnableGradientBackground()
{
  // gradient background is by default only in widget 4, otherwise
  // interferences between 2D rendering and VTK rendering may occur.
  //m_GradientBackground1->Enable();
  //m_GradientBackground2->Enable();
  //m_GradientBackground3->Enable();
  m_GradientBackground4->Enable();
}


void QmitkStdMultiWidget::DisableGradientBackground()
{
  //m_GradientBackground1->Disable();
  //m_GradientBackground2->Disable();
  //m_GradientBackground3->Disable();
  m_GradientBackground4->Disable();
}


void QmitkStdMultiWidget::EnableDepartmentLogo()
{
  m_LogoRendering4->Enable();
}


void QmitkStdMultiWidget::DisableDepartmentLogo()
{
  m_LogoRendering4->Disable();
}


mitk::SlicesRotator * QmitkStdMultiWidget::GetSlicesRotator() const
{
  return m_SlicesRotator;
}


mitk::SlicesSwiveller * QmitkStdMultiWidget::GetSlicesSwiveller() const
{
  return m_SlicesSwiveller;
}


void QmitkStdMultiWidget::SetWidgetPlaneVisibility(const char* widgetName, bool visible, mitk::BaseRenderer *renderer)
{
  if (m_DataStorage.IsNotNull())
  {
    mitk::DataNode* n = m_DataStorage->GetNamedNode(widgetName);
    if (n != NULL)
      n->SetVisibility(visible, renderer);
  }
}


void QmitkStdMultiWidget::SetWidgetPlanesVisibility(bool visible, mitk::BaseRenderer *renderer)
{
  SetWidgetPlaneVisibility("widget1Plane", visible, renderer);
  SetWidgetPlaneVisibility("widget2Plane", visible, renderer);
  SetWidgetPlaneVisibility("widget3Plane", visible, renderer);
  mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}


void QmitkStdMultiWidget::SetWidgetPlanesLocked(bool locked)
{
  //do your job and lock or unlock slices.
  GetRenderWindow1()->GetSliceNavigationController()->SetSliceLocked(locked);
  GetRenderWindow2()->GetSliceNavigationController()->SetSliceLocked(locked);
  GetRenderWindow3()->GetSliceNavigationController()->SetSliceLocked(locked);
}


void QmitkStdMultiWidget::SetWidgetPlanesRotationLocked(bool locked)
{
  //do your job and lock or unlock slices.
  GetRenderWindow1()->GetSliceNavigationController()->SetSliceRotationLocked(locked);
  GetRenderWindow2()->GetSliceNavigationController()->SetSliceRotationLocked(locked);
  GetRenderWindow3()->GetSliceNavigationController()->SetSliceRotationLocked(locked);
}


void QmitkStdMultiWidget::SetWidgetPlanesRotationLinked( bool link )
{
  m_SlicesRotator->SetLinkPlanes( link );
  m_SlicesSwiveller->SetLinkPlanes( link );
  emit WidgetPlanesRotationLinked( link );
}


void QmitkStdMultiWidget::SetWidgetPlaneMode( int userMode )
{
  MITK_DEBUG << "Changing crosshair mode to " << userMode;

  emit WidgetNotifyNewCrossHairMode( userMode );
  
  int mode = m_PlaneMode;
  bool link = false;
  
  // Convert user interface mode to actual mode
  {
    switch(userMode)
    {
      case 0:
        mode = PLANE_MODE_SLICING;
        link = false;
        break;
      
      case 1:
        mode = PLANE_MODE_ROTATION;
        link = false;
        break;
     
      case 2:
        mode = PLANE_MODE_ROTATION;
        link = true;
        break;
     
      case 3:
        mode = PLANE_MODE_SWIVEL;
        link = false;
        break;
    }
  }

  // Slice rotation linked
  m_SlicesRotator->SetLinkPlanes( link );
  m_SlicesSwiveller->SetLinkPlanes( link );

  // Do nothing if mode didn't change
  if ( m_PlaneMode == mode )
  {
    return;
  }

  mitk::GlobalInteraction *gi = mitk::GlobalInteraction::GetInstance();

  // Remove listeners of previous mode
  switch ( m_PlaneMode )
  {
  default:
  case PLANE_MODE_SLICING:
    // Notify MainTemplate GUI that this mode has been deselected
    emit WidgetPlaneModeSlicing( false );

    gi->RemoveListener( mitkWidget1->GetSliceNavigationController() );
    gi->RemoveListener( mitkWidget2->GetSliceNavigationController() );
    gi->RemoveListener( mitkWidget3->GetSliceNavigationController() );
    gi->RemoveListener( mitkWidget4->GetSliceNavigationController() );
    break;

  case PLANE_MODE_ROTATION:
    // Notify MainTemplate GUI that this mode has been deselected
    emit WidgetPlaneModeRotation( false );

    m_SlicesRotator->ResetMouseCursor();
    gi->RemoveListener( m_SlicesRotator );
    break;

  case PLANE_MODE_SWIVEL:
    // Notify MainTemplate GUI that this mode has been deselected
    emit WidgetPlaneModeSwivel( false );

    m_SlicesSwiveller->ResetMouseCursor();
    gi->RemoveListener( m_SlicesSwiveller );
    break;
  }

  // Set new mode and add corresponding listener to GlobalInteraction
  m_PlaneMode = mode;
  switch ( m_PlaneMode )
  {
  default:
  case PLANE_MODE_SLICING:
    // Notify MainTemplate GUI that this mode has been selected
    emit WidgetPlaneModeSlicing( true );

    // Add listeners
    gi->AddListener( mitkWidget1->GetSliceNavigationController() );
    gi->AddListener( mitkWidget2->GetSliceNavigationController() );
    gi->AddListener( mitkWidget3->GetSliceNavigationController() );
    gi->AddListener( mitkWidget4->GetSliceNavigationController() );

    mitk::RenderingManager::GetInstance()->InitializeViews();
    break;

  case PLANE_MODE_ROTATION:
    // Notify MainTemplate GUI that this mode has been selected
    emit WidgetPlaneModeRotation( true );

    // Add listener
    gi->AddListener( m_SlicesRotator );
    break;

  case PLANE_MODE_SWIVEL:
    // Notify MainTemplate GUI that this mode has been selected
    emit WidgetPlaneModeSwivel( true );

    // Add listener
    gi->AddListener( m_SlicesSwiveller );
    break;
  }
  // Notify MainTemplate GUI that mode has changed
  emit WidgetPlaneModeChange(m_PlaneMode);
}


void QmitkStdMultiWidget::SetGradientBackgroundColors( const mitk::Color & upper, const mitk::Color & lower )
{
  m_GradientBackground1->SetGradientColors(upper[0], upper[1], upper[2], lower[0], lower[1], lower[2]);
  m_GradientBackground2->SetGradientColors(upper[0], upper[1], upper[2], lower[0], lower[1], lower[2]);
  m_GradientBackground3->SetGradientColors(upper[0], upper[1], upper[2], lower[0], lower[1], lower[2]);
  m_GradientBackground4->SetGradientColors(upper[0], upper[1], upper[2], lower[0], lower[1], lower[2]);
  m_GradientBackground5->SetGradientColors(upper[0], upper[1], upper[2], lower[0], lower[1], lower[2]);
  m_GradientBackground6->SetGradientColors(upper[0], upper[1], upper[2], lower[0], lower[1], lower[2]);
  m_GradientBackground7->SetGradientColors(upper[0], upper[1], upper[2], lower[0], lower[1], lower[2]);

}


void QmitkStdMultiWidget::SetDepartmentLogoPath( const char * path )
{
  m_LogoRendering1->SetLogoSource(path);
  m_LogoRendering2->SetLogoSource(path);
  m_LogoRendering3->SetLogoSource(path);
  m_LogoRendering4->SetLogoSource(path);
  m_LogoRendering5->SetLogoSource(path);
  m_LogoRendering6->SetLogoSource(path);
  m_LogoRendering7->SetLogoSource(path);

}


void QmitkStdMultiWidget::SetWidgetPlaneModeToSlicing( bool activate )
{
  if ( activate )
  {
    this->SetWidgetPlaneMode( PLANE_MODE_SLICING );
  }
}


void QmitkStdMultiWidget::SetWidgetPlaneModeToRotation( bool activate )
{
  if ( activate )
  {
    this->SetWidgetPlaneMode( PLANE_MODE_ROTATION );
  }
}


void QmitkStdMultiWidget::SetWidgetPlaneModeToSwivel( bool activate )
{
  if ( activate )
  {
    this->SetWidgetPlaneMode( PLANE_MODE_SWIVEL );
  }
}

void QmitkStdMultiWidget::OnLayoutDesignChanged( int layoutDesignIndex )
{
  switch( layoutDesignIndex )
  {
  case LAYOUT_DEFAULT:
    {
      this->changeLayoutToDefault();
      break;
    }
  case LAYOUT_2D_IMAGES_UP:
    {
      this->changeLayoutTo2DImagesUp();
      break;
    }
  case LAYOUT_2D_IMAGES_LEFT:
    {
      this->changeLayoutTo2DImagesLeft();
      break;
    }
  case LAYOUT_BIG_3D:
    {
      this->changeLayoutToBig3D();
      break;
    }
  case LAYOUT_WIDGET1:
    {
      this->changeLayoutToWidget1();
      break;
    }
  case LAYOUT_WIDGET2:
    {
      this->changeLayoutToWidget2();
      break;
    }
  case LAYOUT_WIDGET3:
    {
      this->changeLayoutToWidget3();
      break;
    }
  case LAYOUT_2X_2D_AND_3D_WIDGET:
    {
      this->changeLayoutTo2x2Dand3DWidget();
      break;
    }
  case LAYOUT_ROW_WIDGET_3_AND_4:
    {
      this->changeLayoutToRowWidget3And4();
      break;
    }
  case LAYOUT_COLUMN_WIDGET_3_AND_4:
    {
      this->changeLayoutToColumnWidget3And4();
      break;
    }
  case LAYOUT_ROW_WIDGET_SMALL3_AND_BIG4:
    {
      this->changeLayoutToRowWidgetSmall3andBig4();
      break;
    }
  case LAYOUT_SMALL_UPPER_WIDGET2_BIG3_AND4:
    {
      this->changeLayoutToSmallUpperWidget2Big3and4();
      break;
    }
  case LAYOUT_2D_AND_3D_LEFT_2D_RIGHT_WIDGET:
    {
      this->changeLayoutToLeft2Dand3DRight2D();
      break;
    }
  case LAYOUT_5VIEWMODE:
    {
      this->changeLayoutTo5ViewMode();
      break;
    }
  case LAYOUT_6VIEWMODE:
    {
      this->changeLayoutTo6ViewMode();
      break;
    }
  case LAYOUT_7VIEWMODE:
    {
      this->changeLayoutTo7ViewMode();
      break;
    }
  case LAYOUT_WIDGET5:
    {
      this->changeLayoutToWidget5();
      break;
    }
  case LAYOUT_WIDGET6:
    {
      this->changeLayoutToWidget6();
      break;
    }
  case LAYOUT_WIDGET7:
    {
      this->changeLayoutToWidget7();
      break;
    }
  };

}

void QmitkStdMultiWidget::UpdateAllWidgets()
{
  mitkWidget1->resize( mitkWidget1Container->frameSize().width()-1, mitkWidget1Container->frameSize().height() );
  mitkWidget1->resize( mitkWidget1Container->frameSize().width(), mitkWidget1Container->frameSize().height() );

  mitkWidget2->resize( mitkWidget2Container->frameSize().width()-1, mitkWidget2Container->frameSize().height() );
  mitkWidget2->resize( mitkWidget2Container->frameSize().width(), mitkWidget2Container->frameSize().height() );

  mitkWidget3->resize( mitkWidget3Container->frameSize().width()-1, mitkWidget3Container->frameSize().height() );
  mitkWidget3->resize( mitkWidget3Container->frameSize().width(), mitkWidget3Container->frameSize().height() );

  mitkWidget4->resize( mitkWidget4Container->frameSize().width()-1, mitkWidget4Container->frameSize().height() );
  mitkWidget4->resize( mitkWidget4Container->frameSize().width(), mitkWidget4Container->frameSize().height() );

  mitkWidget5->resize( mitkWidget5Container->frameSize().width()-1, mitkWidget5Container->frameSize().height() );
  mitkWidget5->resize( mitkWidget5Container->frameSize().width(), mitkWidget5Container->frameSize().height() );

  mitkWidget6->resize( mitkWidget6Container->frameSize().width()-1, mitkWidget6Container->frameSize().height() );
  mitkWidget6->resize( mitkWidget6Container->frameSize().width(), mitkWidget6Container->frameSize().height() );

  mitkWidget7->resize( mitkWidget7Container->frameSize().width()-1, mitkWidget7Container->frameSize().height() );
  mitkWidget7->resize( mitkWidget7Container->frameSize().width(), mitkWidget7Container->frameSize().height() );

  mitkWidget5->SetCrossHairModeMenuVisible(mitk::BaseRenderer::GetInstance(mitkWidget5->GetRenderWindow())->GetDataStorage());
  mitkWidget6->SetCrossHairModeMenuVisible(mitk::BaseRenderer::GetInstance(mitkWidget6->GetRenderWindow())->GetDataStorage());
  mitkWidget7->SetCrossHairModeMenuVisible(mitk::BaseRenderer::GetInstance(mitkWidget7->GetRenderWindow())->GetDataStorage());
}


void QmitkStdMultiWidget::HideAllWidgetToolbars()
{
  mitkWidget1->HideRenderWindowMenu();
  mitkWidget2->HideRenderWindowMenu();
  mitkWidget3->HideRenderWindowMenu();
  mitkWidget4->HideRenderWindowMenu();
  mitkWidget5->HideRenderWindowMenu();
  mitkWidget6->HideRenderWindowMenu();
  mitkWidget7->HideRenderWindowMenu();

}

void QmitkStdMultiWidget::ActivateMenuWidget( bool state )
{
  mitkWidget1->ActivateMenuWidget( state );
  mitkWidget2->ActivateMenuWidget( state );
  mitkWidget3->ActivateMenuWidget( state );
  mitkWidget4->ActivateMenuWidget( state );
  mitkWidget5->ActivateMenuWidget( state );
  mitkWidget6->ActivateMenuWidget( state );
  mitkWidget7->ActivateMenuWidget( state );
}
 
void QmitkStdMultiWidget::ResetCrosshair()
{
  if (m_DataStorage.IsNotNull())
  {
    mitk::RenderingManager::GetInstance()->InitializeViews( m_DataStorage->ComputeVisibleBoundingGeometry3D() );
    // reset interactor to normal slicing
    this->SetWidgetPlaneMode(PLANE_MODE_SLICING);
  }
}

void QmitkStdMultiWidget::EnableColoredRectangles()
{
  m_RectangleRendering1->Enable(1.0, 0.0, 0.0);//100
  m_RectangleRendering2->Enable(0.0, 1.0, 0.0);//010
  m_RectangleRendering3->Enable(0.0, 0.0, 1.0);//001
  m_RectangleRendering4->Enable(1.0, 1.0, 0.0);//110
  m_RectangleRendering5->Enable(1.0, 0.0, 1.0);//101
  m_RectangleRendering6->Enable(0.0, 1.0, 1.0);//011
  m_RectangleRendering7->Enable(0.0, 0.0, 0.0);//000
}

void QmitkStdMultiWidget::DisableColoredRectangles()
{
  m_RectangleRendering1->Disable();
  m_RectangleRendering2->Disable();
  m_RectangleRendering3->Disable();
  m_RectangleRendering4->Disable();
  m_RectangleRendering5->Disable();
  m_RectangleRendering6->Disable();
  m_RectangleRendering7->Disable();
}
